Reputation: 2022
Okay, so I wrote an API using Flask-Restful and now I want to implement OAuth2 authorization.
I've tried pyoauth2, but it's undocumented and the tutorial is quite complicated.
So, my question is: How do I do that?
Upvotes: 9
Views: 7378
Reputation: 1947
Follow the flask-oauthlib guide to get a basic endpoint set up. Ensure that it works with a vanilla flask endpoint.
Configure your API to use the oauth decorator.
oauth = OAuth2Provider(app)
api = restful.Api(app, decorators=[oauth.require_oauth('email')])
Upvotes: 7