# Update idToken add cutom claims from my next app

**URL:** <https://community.auth0.com/t/update-idtoken-add-cutom-claims-from-my-next-app/122622>\
**Category:** Get Help\
**Tags:** user-profile, user-management\
**Created:** [December 8, 2023, 1:41pm UTC](https://community.auth0.com/t/update-idtoken-add-cutom-claims-from-my-next-app/122622 "2023-12-08T13:41:43Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ghomraniilyas](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ghomraniilyas/32/49956_2.png) [@ghomraniilyas](https://community.auth0.com/u/ghomraniilyas)\
**Post date:** [December 8, 2023, 1:41pm UTC](https://community.auth0.com/t/update-idtoken-add-cutom-claims-from-my-next-app/122622/1 "2023-12-08T13:41:43Z")

</div>

is it possible to add a cutomClaim to the idToken so i can use it with third-part API from my next app

The scenario is that my logged in used should select and item and on the select event i will call my external API by adding the used choice.

The external API also use my auth0 token to determine the user.

---

<div class="post-metadata">

**Author:** ![marcelina.barycka](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/marcelina.barycka/32/56162_2.png) [@marcelina.barycka](https://community.auth0.com/u/marcelina.barycka)\
**Post date:** [December 8, 2023, 2:20pm UTC](https://community.auth0.com/t/update-idtoken-add-cutom-claims-from-my-next-app/122622/2 "2023-12-08T14:20:41Z")

</div>

Hi @ghomraniilyas ,

From what I understand, you want to add a custom claim to the access token which is issued to your API to authorize user for the requested resources. To do so, there is a [Post Login Flow](https://auth0.com/docs/customize/actions/flows-and-triggers/login-flow/event-object) (Actions feature) with a method: `api.accessToken.setCustomClaim(name, value)`.

Hope this helps, please let us know any questions!

---

<div class="post-metadata">

**Author:** ![ghomraniilyas](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ghomraniilyas/32/49956_2.png) [@ghomraniilyas](https://community.auth0.com/u/ghomraniilyas)\
**Post date:** [December 9, 2023, 7:34am UTC](https://community.auth0.com/t/update-idtoken-add-cutom-claims-from-my-next-app/122622/3 "2023-12-09T07:34:58Z")

</div>

> [@marcelina.barycka](#):
>
> do

Thank you for your response @marcelina.barycka i want to add the custom claims after the user make a choice in my app (NextJS app the value is the value of the choice)

So i want to change the token from my app goes to Auth0 and returns to my next app with the new token so i can send it to third-part API

---

<div class="post-metadata">

**Author:** ![marcelina.barycka](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/marcelina.barycka/32/56162_2.png) [@marcelina.barycka](https://community.auth0.com/u/marcelina.barycka)\
**Post date:** [December 11, 2023, 2:15pm UTC](https://community.auth0.com/t/update-idtoken-add-cutom-claims-from-my-next-app/122622/4 "2023-12-11T14:15:50Z")

</div>

Hi @ghomraniilyas ,

> [@ghomraniilyas](#):
>
> i want to add the custom claims after the user make a choice in my app

The flow is described in this doc - [Redirect with Actions](https://auth0.com/docs/customize/actions/flows-and-triggers/login-flow/redirect-with-actions) (redirect to an external page during the login flow and use the gathered from user data to add custom token claims that will be later returned to your app).

---

<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:** [December 25, 2023, 2:15pm UTC](https://community.auth0.com/t/update-idtoken-add-cutom-claims-from-my-next-app/122622/5 "2023-12-25T14:15:57Z")

</div>

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