# How to update claim identity received in asp.net core application

**URL:** <https://community.auth0.com/t/how-to-update-claim-identity-received-in-asp-net-core-application/74400>\
**Category:** JWT.io\
**Tags:** auth0\
**Created:** [December 7, 2021, 1:16pm UTC](https://community.auth0.com/t/how-to-update-claim-identity-received-in-asp-net-core-application/74400 "2021-12-07T13:16:37Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![sushama](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/sushama/32/25479_2.png) [@sushama](https://community.auth0.com/u/sushama)\
**Post date:** [December 7, 2021, 1:16pm UTC](https://community.auth0.com/t/how-to-update-claim-identity-received-in-asp-net-core-application/74400/1 "2021-12-07T13:16:37Z")

</div>

I have an [asp.net](http://asp.net) core application…in which when user logged in we checked either this user have valid subscription or not …and according to this i need to update identity value from claim principle is it possible to update the Claim principle value in [asp.net](http://asp.net) core application

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [December 7, 2021, 11:47pm UTC](https://community.auth0.com/t/how-to-update-claim-identity-received-in-asp-net-core-application/74400/3 "2021-12-07T23:47:00Z")

</div>

Hi @sushama,

I am having a hard time getting a clear understanding of your requirements. Are you trying to update a specific claim in the token? Can you please give us an example?

---

<div class="post-metadata">

**Author:** ![sushama](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/sushama/32/25479_2.png) [@sushama](https://community.auth0.com/u/sushama)\
**Post date:** [December 8, 2021, 5:44am UTC](https://community.auth0.com/t/how-to-update-claim-identity-received-in-asp-net-core-application/74400/4 "2021-12-08T05:44:52Z")

</div>

hi,  
We used auth0 as user identity manager.  
I set the rule for getting custom claim like  
context.idToken[“[http://schemas.xmlsoap.org/ws/2005/05/identity/claims/issubscriptionvalid](http://schemas.xmlsoap.org/ws/2005/05/identity/claims/issubscriptionvalid)”] = false;

Application flow is as follows:

APPLICATION\_1—user logged in with auth0 .  
Getting Claim identity from auth0.  
Now custom claim as mention above also getting in the claim identity.  
In the application I need to update this claim against that user I want to update it as true.  
this is possible to update this claim in [asp.net](http://asp.net) application?  
NOW…  
User logged in to another application say APPLICATION\_2—user logged in with auth0 .  
Getting Claim identity from auth0.  
Now custom claim as mention above also getting in the claim identity.  
but at this time want to get updated claim.

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [December 8, 2021, 8:04pm UTC](https://community.auth0.com/t/how-to-update-claim-identity-received-in-asp-net-core-application/74400/5 "2021-12-08T20:04:02Z")

</div>

Thanks for the update.

If I understand correctly, you are trying to do the following:

- User logs in to application 1
- A Rule adds the issubscriptionvalid = false custom claim to the token
- a token is returned to application 1 with issubscriptionvalid
- you update the user’s profile to issubscriptionvalid = true
- the user logs in to application 2
- a token is returned with issubscriptionvalid = true

If this is the desired flow, you will need to store the issubscriptionvalid flag in the [user’s app\_metadata](https://auth0.com/docs/users/metadata). This allows you to store this flag in the user’s profile in Auth0, and you can later update this using the [Auth0 Management API v2](https://auth0.com/docs/api/management/v2). You can then reference it in a rule, and add it as a custom claim to the token.

Does that make sense?

---

<div class="post-metadata">

**Author:** ![sushama](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/sushama/32/25479_2.png) [@sushama](https://community.auth0.com/u/sushama)\
**Post date:** [December 9, 2021, 4:18am UTC](https://community.auth0.com/t/how-to-update-claim-identity-received-in-asp-net-core-application/74400/6 "2021-12-09T04:18:30Z")

</div>

but how this custom claim added to token ?  
Can I have to set this custom claim in auth0 rule?

---

<div class="post-metadata">

**Author:** ![sushama](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/sushama/32/25479_2.png) [@sushama](https://community.auth0.com/u/sushama)\
**Post date:** [December 9, 2021, 4:19am UTC](https://community.auth0.com/t/how-to-update-claim-identity-received-in-asp-net-core-application/74400/7 "2021-12-09T04:19:25Z")

</div>

Or there is another way to add custom claim?

---

<div class="post-metadata">

**Author:** ![dan.woda](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dan.woda/32/18340_2.png) [@dan.woda](https://community.auth0.com/u/dan.woda)\
**Post date:** [December 9, 2021, 5:32pm UTC](https://community.auth0.com/t/how-to-update-claim-identity-received-in-asp-net-core-application/74400/8 "2021-12-09T17:32:47Z")

</div>

You can add [custom claims](https://auth0.com/docs/tokens/create-namespaced-custom-claims) to the token in an [Login Flow](https://auth0.com/docs/actions/triggers/post-login).

---

<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, 2022, 11:07pm UTC](https://community.auth0.com/t/how-to-update-claim-identity-received-in-asp-net-core-application/74400/9 "2022-01-20T23:07:22Z")

</div>

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