When users register, even though they type the username, I can’t get it from the app, could you tell me how I get this information?
Hi @fidel.torres , welcome to the community!
Do you mean in an ID token? As there isn’t a username
claim in the standard spec, and Auth0 does not automatically map to the OIDC claim of preferred_username
you would need to map the username via a rule, for example:
function (user, context, callback) {
user.preferred_username = user.username; //map username to OIDC standard claim
return callback(null, user, context);
}
This would allow you to return the username via the profile
scope.
Alternatively, you could add it as a custom namespaced claim via a Rule or an Action:
- Actions method: Login Flow
- Rules method: Sample Use Cases: Scopes and Claims
- Create Custom Claims
2 Likes
This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.