# \[Additional Claims\] Looking for a way to add data into an ID Token on the fly without using Inline Hook

**URL:** <https://devforum.okta.com/t/additional-claims-looking-for-a-way-to-add-data-into-an-id-token-on-the-fly-without-using-inline-hook/7852>\
**Category:** Questions\
**Created:** [January 29, 2020, 5:16pm UTC](https://devforum.okta.com/t/additional-claims-looking-for-a-way-to-add-data-into-an-id-token-on-the-fly-without-using-inline-hook/7852 "2020-01-29T17:16:41Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![sanguyen](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/sanguyen/32/1587_2.png) [@sanguyen](https://devforum.okta.com/u/sanguyen)\
**Post date:** [January 29, 2020, 5:16pm UTC](https://devforum.okta.com/t/additional-claims-looking-for-a-way-to-add-data-into-an-id-token-on-the-fly-without-using-inline-hook/7852/1 "2020-01-29T17:16:41Z")

</div>

Hi there,

I’m looking for a way to add/patch custom data into an ID Token on the fly in the authentication flows, without using Inline Hooks. Because most of my company services are behind proxy, so it’s impossible to using Inline Hooks for adding/patching custom data to ID Token. So, I’m wondering that is there any way to do that directly in the exchange token step in the authentication flows (Authorization Code, Client Credentials, etc. ) by passing custom data along when getting access/ ID tokens?

Thanks!

---

<div class="post-metadata">

**Author:** ![sanguyen](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/sanguyen/32/1587_2.png) [@sanguyen](https://devforum.okta.com/u/sanguyen)\
**Post date:** [January 29, 2020, 7:49pm UTC](https://devforum.okta.com/t/additional-claims-looking-for-a-way-to-add-data-into-an-id-token-on-the-fly-without-using-inline-hook/7852/2 "2020-01-29T19:49:35Z")

</div>

I did a quick research, it looks like I can do that with Auth0 [https://auth0.com/docs/api-auth/tutorials/adoption/scope-custom-claims#custom-claims](https://auth0.com/docs/api-auth/tutorials/adoption/scope-custom-claims#custom-claims). Following is the official spec from OpenID [https://openid.net/specs/openid-connect-core-1\_0.html#AdditionalClaims](https://openid.net/specs/openid-connect-core-1_0.html#AdditionalClaims)

---

<div class="post-metadata">

**Author:** ![dragos](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/dragos/32/1313_2.png) [@dragos](https://devforum.okta.com/u/dragos)\
**Post date:** [January 30, 2020, 7:41am UTC](https://devforum.okta.com/t/additional-claims-looking-for-a-way-to-add-data-into-an-id-token-on-the-fly-without-using-inline-hook/7852/3 "2020-01-30T07:41:33Z")

</div>

Hi @sanguyen

If the details that you want to add inside the ID token are available in Okta, you can set up one of the following:

- `profile` scope claims under Admin \>\> Directory/Users \>\> Profile Editor \>\> OIDC app \>\> Profile and map them with values from Okta user profile
- custom claims using custom authorization servers created through [API Access Management SKU](https://www.okta.com/products/api-access-management/), available under Admin \>\> Security \>\> API \>\> Authorization Servers \>\> _your authorization server_ \>\> Claims

---

<div class="post-metadata">

**Author:** ![sanguyen](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/sanguyen/32/1587_2.png) [@sanguyen](https://devforum.okta.com/u/sanguyen)\
**Post date:** [January 30, 2020, 3:55pm UTC](https://devforum.okta.com/t/additional-claims-looking-for-a-way-to-add-data-into-an-id-token-on-the-fly-without-using-inline-hook/7852/4 "2020-01-30T15:55:19Z")

</div>

Thanks @dragos for the reply and information!

I have been using the 2nd one for setting up my custom claims. However, it seems this option can only be used for custom claims with fixed values which we getting from meta data or what we set up in advance. The way which I’m looking for is that I can send along additional data when exchanging authorization\_code to get access\_token/id\_token. This step:

Like can add an additional field in x-www-form-urlencoded  
POST https://{domain}/oauth2/default/v1/token

grant\_type=authorization\_code  
&client\_id=0oapid1h7wG5bllt50h7  
&client\_secret=hjLVt7EZDw-qCDnx36TUEV5k5kHm-gFIHnmzKRon  
&redirect\_uri=https://www.oauth.com/playground/authorization-code.html  
&code=bD-9aYIhqbsQR-4\_BVy\_  
**&my\_custom\_data=…**

Or in the body somehow:

**{**  
**my\_custom\_data: …**  
**}**

So that this additional data can be attached inside the tokens returned.

Thanks

---

<div class="post-metadata">

**Author:** ![dragos](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/dragos/32/1313_2.png) [@dragos](https://devforum.okta.com/u/dragos)\
**Post date:** [January 31, 2020, 4:03am UTC](https://devforum.okta.com/t/additional-claims-looking-for-a-way-to-add-data-into-an-id-token-on-the-fly-without-using-inline-hook/7852/5 "2020-01-31T04:03:52Z")

</div>

Hi @sanguyen

Thank you for your clarification. At the moment, we don’t have an option to add the custom claims in this format, only through the Token Inline Hook feature.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/oktadev/original/1X/589c4c5f80de422d01f47cee7185a7fb8227835c.png) [@system](https://devforum.okta.com/u/system)\
**Post date:** [August 27, 2021, 5:22pm UTC](https://devforum.okta.com/t/additional-claims-looking-for-a-way-to-add-data-into-an-id-token-on-the-fly-without-using-inline-hook/7852/6 "2021-08-27T17:22:07Z")

</div>

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