How can I get my custom scopes in the access token?

Hi @maxime.fleury,

Welcome to the Auth0 Community!

Custom claims can be added to an Access/ID Token in a namespace format by utilizing a Post Login Action. For example:

exports.onExecutePostLogin = async (event, api) => {

 const namespace = 'https://myapp.example.com';
 const { favorite_color, preferred_contact } = event.user.user_metadata;

 if (event.authorization) {
  // Set claims in ID token
  api.idToken.setCustomClaim(`${namespace}/favorite_color`, favorite_color);
  api.idToken.setCustomClaim(`${namespace}/preferred_contact`, preferred_contact);

  // Set claims in access token
  api.accessToken.setCustomClaim(`${namespace}/favorite_color`, favorite_color);
  api.accessToken.setCustomClaim(`${namespace}/preferred_contact`, preferred_contact);
 }
};

Also please check these articles:

Related FAQs:

Thanks,
Timotei