# Use of non-restricted claims in id token

**URL:** <https://community.auth0.com/t/use-of-non-restricted-claims-in-id-token/132317>\
**Category:** Get Help\
**Tags:** apis, application\
**Created:** [April 18, 2024, 3:16pm UTC](https://community.auth0.com/t/use-of-non-restricted-claims-in-id-token/132317 "2024-04-18T15:16:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rshah](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rshah/32/59998_2.png) [@rshah](https://community.auth0.com/u/rshah)\
**Post date:** [April 18, 2024, 3:16pm UTC](https://community.auth0.com/t/use-of-non-restricted-claims-in-id-token/132317/1 "2024-04-18T15:16:49Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [April 18, 2024, 7:32pm UTC](https://community.auth0.com/t/use-of-non-restricted-claims-in-id-token/132317/3 "2024-04-18T19:32:38Z")

</div>

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](https://auth0.com/docs/secure/tokens/json-web-tokens/create-custom-claims#namespaced-guidelines))

Let me know if you have any questions.

Thanks,  
Rueben

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [May 2, 2024, 7:33pm UTC](https://community.auth0.com/t/use-of-non-restricted-claims-in-id-token/132317/4 "2024-05-02T19:33:13Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
