setCustomClaim persistent


I was able to add custom claims in the id token like this

exports.onExecutePostLogin = async (event, api) => {
    api.accessToken.setCustomClaim('myWorld', 'Hello world');

But how come it does not save/persist in the user claims? I had to run the script again.

Thank you

Hi @dotaolaoqua,

I understand you have a question about custom claims.

It looks like you are adding the claim to the Access Token

Are you not seeing it in the token, or are asking about it persisting in the user’s JSON in the Auth0 Database?

It appears you’ve added the custom claim to the Access Token, not the user claims. Please review your code to correctly save it in the user claims.

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