Auth0 Home Blog Docs

Custom claims not added to access_token nor id_token

Hi, I was trying to add user email to access token, but when I log in using getTokenSilently from auth0-spa-js I don’t get it.
This is my rule:

function (user, context, callback) {
    const namespace = 'https://myapiserver.me';
    context.accessToken[namespace+'email'] = user.email;

  callback(null, user, context);
}

And this is what I get in access_token’s payload after decode using jwt.io

{
https://acme.com/claims/role”: “admin”,
“iss”: “https://----.eu.auth0.com/”,
“sub”: “google-oauth2|--------”,
“aud”: [
https://myapiserver.me”,
“https://--------.eu.auth0.com/userinfo”
],
“iat”: ------,
“exp”: ------,
“azp”: “--------”,
“scope”: “openid profile email”,
“permissions”: [
“add:task”,
“get:task”,
“sync:task”
]
}