This article details how to modify the preferred_username claim from the ID_token to a different value.
- OpenID Connect (OIDC)
General information and requirements:
- By default, the
preferred_usernameclaim is mapped as the "userName" in the application user profile, which will be populated as the primary email address of the user. - In order to receive the
preferred_usernameclaim in the user's ID token, the profile scope must be included in the /authorize request (specified in the app code/service provider's configuration dashboard).
How to modify the claim
- In the Okta Admin dashboard, navigate to Directory > Profile Editor.
- Select the Apps section.
- Find the relevant OIDC app and select Mappings.
- In the profile mappings section, modify the following:
The preferred_username claim can be modified to return a different value from the user's profile. (even a custom expression value can be used)
Related References
