Hey there @oleh.naumenko welcome to the community!
Just to confirm, you are setting a name
property in a user’s user_metadata currently? If that’s the case, you can use an Action to override the name
claim in ID and/or access tokens using something like the following code:
exports.onExecutePostLogin = async (event, api) => {
// Check if the user_metadata has the "name" key
if (event.user.user_metadata && event.user.user_metadata.name) {
// Set a custom claim in the ID Token
api.idToken.setCustomClaim('name', event.user.user_metadata.name);
// Set a custom claim in the Access Token
api.accessToken.setCustomClaim('name', event.user.user_metadata.name);
}
};