since user_metadata
is not part of the standard claims and so it is not present in the OIDC response from Auth0, we need to create a Rule to add it as a custom claim. The rule would look something like this:
function (user, context, callback) {
var namespace = 'https://myapp.example.com/'; // note that you cannot use auth0.com, webtask.io and webtask.run as a namespace identifier
if (context.idToken && user.user_metadata) {
context.idToken[namespace + 'user_metadata'] = user.user_metadata;
}
callback(null, user, context);
}
https://auth0.com/docs/rules/current/metadata-in-rules
Can you give that a try and please let us know if it does what you are looking to do