No claims returned after login

I am new to oauth and new to auth0, so forgive me if my question is too dumb. :slight_smile:

I am using a Regular Web App (using asp.net core 2.2) and the Universal Login.

My scenario is actually very simple, I just want to be able to see the roles or permissions/scopes that one user has access, after a successful login.

I am using the example app that Auth0 show us at QuickStart section, and after a successful login using the Google Social provider, just the “nameidentifier” claim is present.

My user has 1 role and this role has one permission (to a Test API).

What am I missing here? How do I get this role after a successful login?

Many thanks for your time and patience :slight_smile:

1 Like

Hi @jonathas.costa,

Are you using the authorization core or authorization extension?

Thanks,
Dan

I think I am using Core RBAC… how can I be sure?

@jonathas.costa,

If you are using Roles under the Users & Roles tab of the Auth0 Dashboard, that is the core RBAC. Otherwise you would be using the Authorization Extension under the Extensions tab.

Thanks,
Dan

Ok, then I am using Core.

@jonathas.costa,

Okay there are a few different strategies here.

If you want to add roles to a token as a custom claim, you can do that in a rule.
https://auth0.com/docs/scopes/current/sample-use-cases#add-custom-claims-to-a-token
Example rule:

function (user, context, callback) {
  const namespace = 'https://myapp.example.com/';
  context.idToken[namespace + 'roles'] = context.authorization.roles;
  callback(null, user, context);
}

This topic also has some different strategies we could discuss if the custom claims solutions isn’t right for you.

Let me know if you have any questions.
Thanks,
Dan

It works! Thanks a lot!

1 Like

Glad to hear it!

Good Luck,
Dan

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