I am using the simple auth0-spa-js library, but I am unable to app_metadata or user_metadata in any token.
I’ve tried every topic here related to actions, where this appeared to be the recommended choice:
exports.onExecutePostLogin = async (event, api) => {
const namespace = '<my domain>;
if (event.authorization) {
api.idToken.setCustomClaim(`${namespace}/user_metadata`, event.user.user_metadata);
api.idToken.setCustomClaim(`${namespace}/app_metadata`, event.client.metadata);
}
};
I tried adding scopes to the login, using:
const client = new Auth0Client({
domain: PUBLIC_AUTH0_DOMAIN,
clientId: PUBLIC_AUTH0_CLIENT_ID,
authorizationParams: {
audience: PUBLIC_AUTH0_AUDIENCE,
redirect_uri: PUBLIC_AUTH0_REDIRECT_URL,
scope: 'openid profile email app_metadata user_metadata'
}
})
But I keep getting JWT’s without ANYTHING extra in it. It is driving me absolutely crazy that I can not find a way to do this. The documentation is sometimes out of date.
What am I doing wrong?