Use of non-restricted claims in id token

Hello everyone ,

We have requirement where underlying framework uses email, preferred_username, name, given_name, family_name and nickname.

We can not provide scope =“profile” because of framework limitations .

So using actions we tried to add username in custom claims but because of preferred_username is part of non-restricted claims it’s not being added to id token

api.idToken.setCustomClaim(preferred_username, event.user.username);

We can not use namespace/preferred_username as well because framework won’t recognize it .

Is there a way to use “preferred_username” in id token using custom claims?

Hi @rshah,

Unfortunately, that won’t be possible.

If you would like to set those attributes as a custom claim in your ID token, you must use namespace identifiers. (Reference: Create Custom Claims)

Let me know if you have any questions.

Thanks,
Rueben