# Using App Metadata to customize access token per client for M2M applications

**URL:** <https://community.auth0.com/t/using-app-metadata-to-customize-access-token-per-client-for-m2m-applications/97615>\
**Category:** Get Help\
**Created:** [January 6, 2023, 7:31am UTC](https://community.auth0.com/t/using-app-metadata-to-customize-access-token-per-client-for-m2m-applications/97615 "2023-01-06T07:31:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gavin3466](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/gavin3466/32/41957_2.png) [@gavin3466](https://community.auth0.com/u/gavin3466)\
**Post date:** [January 6, 2023, 7:31am UTC](https://community.auth0.com/t/using-app-metadata-to-customize-access-token-per-client-for-m2m-applications/97615/1 "2023-01-06T07:31:23Z")

</div>

I have an API that needs to authorize access based on company\_id. One way to do it is to maintain a mapping of the company ID and all the client IDs (M2M apps) it generates. I am wondering whether it’d be better/secure to just embed the company ID in the access token instead. Here is the workflow I plan to implement -

1. when a company creates the M2M app (via our portal), we put the company\_id in the app metadata;
2. we then use Action to put App Metadata in the Access token as a custom claim;
3. Our API upon receiving the access token, decodes jwt and extract company\_id and use it for authorization.

Will this work? Is that any security issue with this approach?

Thanks!!!

---

<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:** [January 6, 2023, 5:21pm UTC](https://community.auth0.com/t/using-app-metadata-to-customize-access-token-per-client-for-m2m-applications/97615/3 "2023-01-06T17:21:04Z")

</div>

Hi @gavin3466,

Thanks for reaching out to the Auth0 Community!

> [@gavin3466](#):
>
> Will this work? Is that any security issue with this approach?

Yes! Your proposed approach will work and will be a secure way to handle authorization.

Here is a helpful FAQ resource I recommend reading: [Adding custom claims to tokens](https://community.auth0.com/t/adding-custom-claims-to-tokens/84590)

Please let me know if you have any additional 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:** [January 20, 2023, 5:22pm UTC](https://community.auth0.com/t/using-app-metadata-to-customize-access-token-per-client-for-m2m-applications/97615/4 "2023-01-20T17:22:00Z")

</div>

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