Angular Access Token Custom Claims

Hi,
I followed the Angular SPA Tutorial from the auth0 site.

In addition to that I added custom claims to the token via actions.

The custom claims are added successfully and I can see them, when I visit the “getting started → Try your Login box” on the auth0 dashboard.

The Problem is, that these Informations are not visible with the angular auth0 sdk.

I used all methods provided by the angular sdk (like getAccessTokenSilently, getIdTokenClaims, idTokenClaims$, …) but no information about the roles I added as custom claims with actions.

How can I access the roles?

EDIT: solved it, but why only the /roles claims are show with the angular sdk?

exports.onExecutePostLogin = async (event, api) => {
  const namespace = 'https://test.one';

  api.accessToken.setCustomClaim(`${namespace}/hello`, 'world');

  if (event.authorization) {
    api.accessToken.setCustomClaim(`${namespace}/roles`, event.authorization.roles);
    api.idToken.setCustomClaim(`${namespace}/roles`, event.authorization.roles);
  }


};

I am also having the same Issue.

I haven’t found a resolution for yet. Thanks.

Hey there @maei welcome to the community, glad you were able to resolve this :slight_smile: If you want to elaborate on your question I’d be happy to respond.

@neskemiquel Can you elaborate on your specific question? The more information you can share the better!

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