Hi @avinash.m,
Welcome to the Auth0 Community!
Access tokens with an Auth0 API audience, excluding the /userinfo
endpoint, cannot have private, non-namespaced custom claims.
- Auth0 will restrict the creation of private, non-namespaced custom claims on access tokens in which the audience is an Auth0 API.
- Any attempt to set a private, non-namespaced custom claim on an access token where the audience is an Auth0 API will be ignored. The transaction will not fail, but the claim will not be added to your token. Auth0 recommends not setting custom claims on tokens that are to be consumed by Auth0’s APIs.
To add custom claims to Access Token, please refer to these articles:
- Adding custom claims to tokens
- Set Access Token Claims Using Actions
- Add custom claims to access token without a namespace
Also, I would try this code below using the namespace
format:
Therefore, if you are using one of our default audiences, you will have to utilize the namespace claims.
Thanks,
Timotei