# Add Organization metadata in token

**URL:** <https://community.auth0.com/t/add-organization-metadata-in-token/90610>\
**Category:** Get Help\
**Tags:** access\_token, organizations, metadata\
**Created:** [September 14, 2022, 4:12pm UTC](https://community.auth0.com/t/add-organization-metadata-in-token/90610 "2022-09-14T16:12:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bittu.anupam](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/bittu.anupam/32/39912_2.png) [@bittu.anupam](https://community.auth0.com/u/bittu.anupam)\
**Post date:** [September 14, 2022, 4:12pm UTC](https://community.auth0.com/t/add-organization-metadata-in-token/90610/1 "2022-09-14T16:12:11Z")

</div>

Hi,

Is it possible to add Organization’s meta\_data (key value pair) to the token in sigin in flow? If yes, how?

I am looking for a scenarion where I want to store subscription tier information in the Organization’s metadata and want to make it available to the application in access token.

Thanks!

---

<div class="post-metadata">

**Author:** ![adam.housman](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/adam.housman/32/19907_2.png) [@adam.housman](https://community.auth0.com/u/adam.housman)\
**Post date:** [September 14, 2022, 6:27pm UTC](https://community.auth0.com/t/add-organization-metadata-in-token/90610/2 "2022-09-14T18:27:22Z")

</div>

Hi @bittu.anupam - sure, you can get that out of the `event.organization.metadata` object in the Action event object: [Actions Triggers: post-login - Event Object](https://auth0.com/docs/customize/actions/flows-and-triggers/login-flow/event-object). Then you can attach it to a custom claim using the API `api.accessToken.setCustomClaim` method: [Actions Triggers: post-login - API Object](https://auth0.com/docs/customize/actions/flows-and-triggers/login-flow/api-object)

Something like this:

```auto
exports.onExecutePostLogin = async (event, api) => {
  let namespace = "https://myapp.com/";
  if (event.organization && event.organization.metadata && event.organization.metadata["subscription"])
    api.idToken.setCustomClaim(`${namespace}subscriptionPlan`, event.organization.metadata["subscription"] );
  }
}

```

---

<div class="post-metadata">

**Author:** ![bittu.anupam](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/bittu.anupam/32/39912_2.png) [@bittu.anupam](https://community.auth0.com/u/bittu.anupam)\
**Post date:** [September 15, 2022, 5:09am UTC](https://community.auth0.com/t/add-organization-metadata-in-token/90610/3 "2022-09-15T05:09:49Z")

</div>

Thanks for the help! It works!

---

<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:** [September 29, 2022, 5:10am UTC](https://community.auth0.com/t/add-organization-metadata-in-token/90610/4 "2022-09-29T05:10:37Z")

</div>

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