Incorrect locale claim in ID/Access token.
If the "locale" attribute in the user's profile was updated to fr_CA (or other value), but that value is not seen in the tokens, then update the "locale" attribute expression and create a custom claim in the custom authorization server. This article is a guide through the process.
- ID/Access token
- Claims
user.countryCode == null ? "en_US" : user.countryCode is set as the mapping expression for locale in the user's profile, which will cause the locale attribute to be en_US.
This can be solved as follows:
- Go to Directory > Profile Editor > choose the app > click on Mappings > select Okta User to "DesiredAppName" > select the locale field.
The following expression should be in here:
user.countryCode == null ? "en_US" : user.countryCode
Change that to:
user.locale
Scroll below and enter the user for preview. If the updated locale attribute is seen, then click on Save Mappings.
- Go to Security > API > choose the custom authorization server > Claims. Add the custom claim so that the locale info is included in the ID/Access token.
Now, if a request to the /userinfo endpoint is made, the locale custom claim should be included and updated in the tokens.
