3

My question is similar to this question.

My goal is the same, but the answer given there uses a library that appears to have been superseded by Authlib. Does Authlib expose a similar decorator I could import? Can anyone link me to a solution or documentation on this? (I couldn't find anything listed in Authlib).

If anyone has any other solutions, I'd love to hear them. How do I use OAuth2 with a Flask-RESTPlus API?

Phoenix911
  • 31
  • 1

1 Answers1

0

I think you are looking for the RFC6750 implementation.

Authlib implements this using ResourceProtector and BearerTokenValidator. You can call ResourceProtector() to return a require_oauth decorator to protect your resources.

See this link Resource Server.

If your are not managing the tokens, but using a 3rd party authentication server, then you can use introspection-in-resource-server.

In case you want to add "authentication", there are also other libraries which can simplify further the token management based on OpenID Connect, see FLAAT.

Community
  • 1
  • 1
BorjaEst
  • 390
  • 2
  • 11