dorinclisu / fastapi-auth0

FastAPI authentication and authorization using auth0.com
MIT License
229 stars 39 forks source link

Get a lost of user roles? #33

Closed emillykkejensen closed 1 year ago

emillykkejensen commented 1 year ago

Quite new to auth0 so really like your repo here. Is there any way to get all the roles, assigned to a user?

dorinclisu commented 1 year ago

Not possible to get role information from the access token, because it's an anti-pattern to implement authorization by checking role names. Instead, auth0 roles contain sets of permissions, and the access token of the user contains the combined permissions of the roles assigned to the user.

Then the api endpoints implement checks for the specific permissions.