dorinclisu / fastapi-auth0

FastAPI authentication and authorization using auth0.com
MIT License
230 stars 37 forks source link

Client Credentials Scheme #17

Closed rhinck closed 3 years ago

rhinck commented 3 years ago

I've been integrating this package into my application and had a question regarding schemes.

If I understand correctly, the purpose of the auth schemes is to interface with OpenAPI and allow a developer to be able to test the API and authenticate directly from the FastAPI docs section of our APIs. Is that correct?

If so, I tried reading through the source code and didn't see a client credentials (m2m) scheme. Do you have any advice on how I could implement the client credentials scheme for Auth0 so I can authenticate using my m2m client id and client secret from the docs?

dorinclisu commented 3 years ago

That's correct, and I think we could add client credentials scheme as well. But it's not here because I considered it to be a trivial case which is already covered by auth0 dashboard.

You can go to the m2m application "Quick Start" tab and copy the token in the response. The token should be pasted as Auth0HTTPBearer in the Swagger available authorizations. This bearer scheme will always be present as long as you have auth.get_user as a dependency, regardless of the scheme specified for the path op.