Retrieve user roles and permission on profile with nextjs

Hi, i’m using
@auth0/nextjs-auth0@^1.9.2

I added some roles and permission to the user but i cannot see those on user profile.

I get a JSON like this:

{
    "given_name": "XXX",
    "family_name": "XXX",
    "nickname": "XXXX",
    "name": "TEST",
    "picture": "https://lh3.googleusercontent.com/a/ALm5wu00F67aDunHRV9EdLjKN94LbOYW7E9LbPFWCtOE=s96-c",
    "locale": "it",
    "updated_at": "2022-10-10T06:56:02.203Z",
    "email": "xxxxxxxxx@gmail.com",
    "email_verified": true,
    "sub": "google-oauth2|10015xxxxxxxx23",
    "sid": "Yoxxxc-_-txxxxxxx7L"
}

How i can add those fields to the user i’m getting on the frontend?

hey @barekliton welcome to the community!

You’ll need to explicitly add the roles to ID Tokens using an Action as outlined in the following FAQ:

Permissions are a bit different, and are typically kept within the context of an access token. I recommend taking a look at RBAC as this provides you with the option (assuming you have an API registered in Auth0) to automatically add permissions to user’s access tokens.

Hope this helps!

1 Like

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