tyf
October 26, 2023, 9:57pm
7
Thanks for confirming!
nalawalaq:
The auth0 authentication is working without any issues but this authorization that i want to perform is not possible.
I’ve tried various methods as well as gone through the auth0 rbac docs but i cannot find a solution for this
Are you able to validate an access token successfully? Once validated, you should be able to make decisions in your API/backend logic based on the permissions
claim and/or roles if you add them as a custom claim in the access token:
Problem statement
Is it possible to retrieve the user’s Roles and/or Permissions and include them in the JWT Token?
Solution
Yes, it’s possible to retrieve the user’s Roles and/or Permissions and append them to either the ID Token or Access Token. To do so, you must use a Post-Login Action script.
1.1 Roles
When adding the user’s Roles to the token, call the event.authorization.roles property and add it as a custom claim to the Token. Please see here on creating namespaced custom claims. Be…