# Custom claims missing after successful form action in post-login flow

**URL:** <https://community.auth0.com/t/custom-claims-missing-after-successful-form-action-in-post-login-flow/186550>\
**Category:** Get Help\
**Tags:** login-experience, new-universal-login-experience\
**Created:** [May 9, 2025, 10:06pm UTC](https://community.auth0.com/t/custom-claims-missing-after-successful-form-action-in-post-login-flow/186550 "2025-05-09T22:06:11Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![lbarbosa1](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/lbarbosa1/32/62158_2.png) [@lbarbosa1](https://community.auth0.com/u/lbarbosa1)\
**Post date:** [May 9, 2025, 10:06pm UTC](https://community.auth0.com/t/custom-claims-missing-after-successful-form-action-in-post-login-flow/186550/1 "2025-05-09T22:06:11Z")

</div>

Hello there!

I’m working on a POC to showcase the forms feature to my team and to implement it in our project. However, I’m experiencing an issue with the post-login flow after the action that renders my form.

We have an action that sets custom claims in the access token and adds custom metadata to the ID token. But when we use the action that renders a form, these custom claims and metadata are missing at the end of the post-login flow.

We’re using a simple form without complex logic, very similar to the example shown in your documentation.

Do you have any idea what might be causing this issue?  
If I remove the form action, the post-login flow works correctly.

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![Joe439Day](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/joe439day/32/74160_2.png) [@Joe439Day](https://community.auth0.com/u/Joe439Day)\
**Post date:** [May 12, 2025, 5:57pm UTC](https://community.auth0.com/t/custom-claims-missing-after-successful-form-action-in-post-login-flow/186550/3 "2025-05-12T17:57:21Z")

</div>

Hello!  
The form action might be interfering with custom claims and metadata in your post-login flow. Try setting claims after the form action, ensuring the correct token scope and audience, and verifying namespace formatting. If removing the form action restores claims, consider handling claims separately from the form rendering process.

---

<div class="post-metadata">

**Author:** ![nik.baleca](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/nik.baleca/32/68749_2.png) [@nik.baleca](https://community.auth0.com/u/nik.baleca)\
**Post date:** [May 12, 2025, 6:03pm UTC](https://community.auth0.com/t/custom-claims-missing-after-successful-form-action-in-post-login-flow/186550/4 "2025-05-12T18:03:25Z")

</div>

Hi @lbarbosa1

Welcome to the Auth0 Community!

As @Joe439Day mentioned, there might be some confusion, interference between the data of the action and the data of the form which could cause the issue at hand. If you could provide snippets of the form and action that you are using or if you can DM the tenant name so I can take a look myself, that would be great.

> If removing the form action restores claims, consider handling claims separately from the form rendering process.

Indeed, setting a custom claim might be better if done in a separate action then inside the same on you are rendering the form in. However, if you need to access data from the form, that might not be suitable.

If you have any other questions, let me know!

Kind Regards,  
Nik

---

<div class="post-metadata">

**Author:** ![lbarbosa1](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/lbarbosa1/32/62158_2.png) [@lbarbosa1](https://community.auth0.com/u/lbarbosa1)\
**Post date:** [May 12, 2025, 6:38pm UTC](https://community.auth0.com/t/custom-claims-missing-after-successful-form-action-in-post-login-flow/186550/5 "2025-05-12T18:38:47Z")

</div>

Hi guys, thanks for replying to me!

In my post-login flow, I have several specific actions to handle different things.  
One of them sets custom claims in the access token and ID token — this action only does that, nothing else.  
It currently works perfectly in production without the form action.

The problem appears when I place the form action at the beginning of the post-login flow.

Here’s the code for the form action:

```auto
exports.onExecutePostLogin = async (event, api) => {
  api.prompt.render(event.secrets.formId);
};

exports.onContinuePostLogin = async (event, api) => {};

```

The form is very generic:

 ![image](https://global.discourse-cdn.com/auth0/original/3X/1/d/1db2d3cb7f85a10c3f46725700b479741014a357.png)  
Here’s the body for the flow, Update User:

```auto
{
  "user_metadata": {
    "apodo": "{{fields.apodo}}",
    "telofono": "{{fields.telefono.number}}"
  }
}

```

and I set User ID field using this value: `{{context.user.user_id}}`  
I don’t use any data from the form to create these custom claims.  
The vault has permission to update users, and It is connected.

---

<div class="post-metadata">

**Author:** ![nik.baleca](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/nik.baleca/32/68749_2.png) [@nik.baleca](https://community.auth0.com/u/nik.baleca)\
**Post date:** [May 12, 2025, 6:46pm UTC](https://community.auth0.com/t/custom-claims-missing-after-successful-form-action-in-post-login-flow/186550/6 "2025-05-12T18:46:50Z")

</div>

Got it! Thanks for the extra details on the matter.

Could you check inside the logs after the login is successful if there are any errors related to the form/action not being able to be executed?

I will test it out on my end to see if I am able to reproduce this behaviour and what might be the cause.

I will come back with an update as soon as possible!

Kind Regards,  
Nik

---

<div class="post-metadata">

**Author:** ![lbarbosa1](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/lbarbosa1/32/62158_2.png) [@lbarbosa1](https://community.auth0.com/u/lbarbosa1)\
**Post date:** [May 12, 2025, 7:08pm UTC](https://community.auth0.com/t/custom-claims-missing-after-successful-form-action-in-post-login-flow/186550/7 "2025-05-12T19:08:41Z")

</div>

I checked the flow logs and it shows as COMPLETED:

```auto
{
  "type": "CONTINUE_SEQUENCE",
  "params": {},
  "artifacts": {}
}

```

Also, in the logs section, there are no errors for the user in any of the actions.  
The user’s login is successful, but it doesn’t have the claims that I need in order to continue on my website.

---

<div class="post-metadata">

**Author:** ![lbarbosa1](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/lbarbosa1/32/62158_2.png) [@lbarbosa1](https://community.auth0.com/u/lbarbosa1)\
**Post date:** [May 16, 2025, 3:35pm UTC](https://community.auth0.com/t/custom-claims-missing-after-successful-form-action-in-post-login-flow/186550/8 "2025-05-16T15:35:17Z")

</div>

Hello there,

I hope you’re doing well.  
I just wanted to follow up and check if there are any updates regarding the issue I reported. It’s currently blocking us.

Looking forward to your help.  
Thanks in advance!

---

<div class="post-metadata">

**Author:** ![nik.baleca](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/nik.baleca/32/68749_2.png) [@nik.baleca](https://community.auth0.com/u/nik.baleca)\
**Post date:** [May 16, 2025, 5:27pm UTC](https://community.auth0.com/t/custom-claims-missing-after-successful-form-action-in-post-login-flow/186550/9 "2025-05-16T17:27:47Z")

</div>

Hi @lbarbosa1

I am sorry about the delayed response to your inquiry!

I have tested out the forms on my end and after the user authenticated, it had all the data and the custom claims I have set present.

Below you can see the `idToken` post login, the user metadata set and the actions used:

_ **USER METADATA** _

 ![image](https://global.discourse-cdn.com/auth0/original/3X/5/4/549ef6c41a2028a3b3a67ce77a0cf73dc9cbf09d.png)  
_ **ID TOKEN** _  
 ![image](https://global.discourse-cdn.com/auth0/original/3X/9/e/9e9020d390c711c2abc47a1947b9c76cb601e333.png)  
_ **TRIGGER FLOW** _  
 ![image](https://global.discourse-cdn.com/auth0/original/3X/1/5/1558843d9ca9c6bb290cea7f338856adbb75cd4c.png)  
_ **FORM RENDERING** _  
 ![image](https://global.discourse-cdn.com/auth0/original/3X/2/6/2671800071cef34f89eb9c0fd8a98397c6b792c0.png)  
_ **CUSTOM CLAIMS SET** _  
 ![image](https://global.discourse-cdn.com/auth0/original/3X/f/e/fec8a2409b3c4c62fd523582c42dec10c884212c.png)

Here is how my forms and flow are set up:  
_ **FORM** _

 ![image](https://global.discourse-cdn.com/auth0/original/3X/e/f/eff7270facfb4f67ccca0c2cfecad3a0d85d867a.png)  
_ **STEP DATA** _  
 ![image](https://global.discourse-cdn.com/auth0/original/3X/1/6/166fd95ef8eb8069dab062cb3b998ed1cbd6acc7.png)  
_ **FLOW DATA** _  
 ![image](https://global.discourse-cdn.com/auth0/original/3X/6/8/68a0d94fcf9ee9ed4ab1404cf0a51ccc6fb65f9a.png)

I could not identify any issues to why either the user metadata or the custom claims would not be setting.  
If you would follow my approach, the user should contain all the necessary details entered in the form.

Let me know if you need help with anything else or if you have any other questions on the matter!

Kind Regards,  
Nik

---

<div class="post-metadata">

**Author:** ![lbarbosa1](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/lbarbosa1/32/62158_2.png) [@lbarbosa1](https://community.auth0.com/u/lbarbosa1)\
**Post date:** [May 20, 2025, 6:47pm UTC](https://community.auth0.com/t/custom-claims-missing-after-successful-form-action-in-post-login-flow/186550/10 "2025-05-20T18:47:12Z")

</div>

Thx nik!  
We had an other issue in our client using the Auth0’s SDK.

The problem related in this post was resolved.

Thanks!

---

<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:** [June 3, 2025, 6:47pm UTC](https://community.auth0.com/t/custom-claims-missing-after-successful-form-action-in-post-login-flow/186550/11 "2025-06-03T18:47:57Z")

</div>

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