How do i get claims from access token in @auth0/nextjs lib?

Hi there i have a nextjs app and we have roles / permission setup. I return the permissions in the access token as a claim. Is there a way to read them from the nextjs api?

I found a getSession but all it returns is the encoded JWT access token.

Thanks in advance

Hey there @danyo welcome to the community!

Where is exactly in your app are you looking to access the permissions? If you can elaborate on your use case a bit that could be helpful.

The following post may have the answer(s) you are looking for:

Let us know!

Hi tyf.
I was looking to access the permissions from the nextjs server api.

I want to create an identity api endpoint which returns the permissions along with some other user data that is only stored in the access token so i can tailor the ui display based on a users permissions.

In the end i just went with the authorized scopes since they are available in the api. Seems to work okay.

1 Like

Hey @danyo apologize for the delayed response here, but thanks a bunch for following up with the community!

This is a totally valid approach - It’s common to infer permissions this way based on scopes.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.