# Metadata and ID Token query

**URL:** <https://community.auth0.com/t/metadata-and-id-token-query/103039>\
**Category:** Get Help\
**Tags:** users, management-api\
**Created:** [March 21, 2023, 10:49pm UTC](https://community.auth0.com/t/metadata-and-id-token-query/103039 "2023-03-21T22:49:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![parthp](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@parthp](https://community.auth0.com/u/parthp)\
**Post date:** [March 21, 2023, 10:49pm UTC](https://community.auth0.com/t/metadata-and-id-token-query/103039/1 "2023-03-21T22:49:07Z")

</div>

Hi,

I would like to know what would be the best place to store user data - member#. In a security context of our application, we consider member# one of PII fields. Now, depending on the member#, application controls the access of different modules. So, should it be stored in user\_metadata or app\_metadata? FYI, member# should only be added at the time of registration or can be updated by support team only. It cannot be updated by a member.

Another question is how if we store member# in ID token as a claim, can that considered to be a security risk? I am not sure if man-in-the-middle can retrieve ID token or not. But if they can then I will have to use management API to retrieve the user metadata.

Any suggestions are highly appreciated.

---

<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:** [March 22, 2023, 12:22am UTC](https://community.auth0.com/t/metadata-and-id-token-query/103039/3 "2023-03-22T00:22:56Z")

</div>

Hi @parthp,

Thanks for reaching out to the Auth0 Community!

> [@parthp](#):
>
> should it be stored in user\_metadata or app\_metadata?

There is no functional difference between storing the user data in the app\_metadata or user\_metadata properties, only a semantic difference.

The difference between `app_metadata` and `user_metadata` is that the first should be used for information about the user that is **controlled by the application** (e.g. the user identifier for a legacy system, or the roles a user has), whereas `user_metadata` is information that the user can view and control (e.g. user settings, preferences). [Reference: [Differences between client\_metadata and app\_metadata](https://community.auth0.com/t/differences-between-client-metadata-and-app-metadata/21388#:~:text=The%20different%20between,user%20settings%2C%20preferences)]

> [@parthp](#):
>
> Another question is how if we store member# in ID token as a claim, can that considered to be a security risk?

This should be fine and is **not** a security risk as long as the member# is considered non-confidential information. If it is considered condifidential information, then it is not recommended to store this information in the token as a custom claim.

I hope that helps!

Please reach out again if you have any further 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:** [April 5, 2023, 1:24am UTC](https://community.auth0.com/t/metadata-and-id-token-query/103039/5 "2023-04-05T01:24:44Z")

</div>

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