Access permissions assigned to a role using Auth0 Next.js SDK

I’m using Auth0 Next.js SDK to authenticate users and I would also like to use it to authorize access to certain pieces of UI functionality. I have RBAC enabled and a few roles defined, each with various permissions. Some permissions are shared across roles. For example, the edit permission might exist on role A and role B. My issues is that I can’t figure out how to expose the permissions to the Nextjs server so that I can adjust the UI according to the user’s permissions. I’m able to expose the roles by setting a custom claim using Actions with this code

api.idToken.setCustomClaim (persona, event.authorization.roles);

but I’m unable to determine what UI permissions are associated with each role.

Would someone provide an example of how to access the Permissions that are assigned to a user through Roles from the NextJs server? I should note that I’m able to see the correct permission on the access token when I decode the token on JWT.io. I just don’t how to get to that data. I searched the forum but didn’t find anything that showed how this can be done. Sorry, if this is a repeat question.

1 Like