Why post login action is failing

Hello, so I followed this article from developer auth0 labs: add-additional-signup-steps in order to get extra data from my users.

I added a form and a flow to my universal login. I want the flow to add a given name and family name to the user data from the fields.

{
“given_name”: “{{fields.first_name}}”,
“family_name”: “{{fields.last_name}}”
}

I went over the post-login actions and added a new action

exports.onExecutePostLogin = async (event, api) => {

const FORM_ID = ‘my-form-id’;

if (!event.user.family_name || !event.user.given_name) {

api.prompt.render(FORM_ID)

}

};

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

};

My Post login now looks as follow:

Begin → Ask for Name and Last name → Add email to JWT → End

All is well, everything is working fine. However, when I get prompt that form and fill it out, I observe two things:

  1. Auth0 never adds the new fields to my user data.
  2. I see the log: Failed Silent Auth + Custom prompt interaction required (my angular app apparently fails)

I don’t observe this behavior when user family name and given name is already filled by the user for instance when using google connection. Please help!

Hi @oussama

Welcome to the Auth0 Community!

Using our React Sample application, I was not able to replicate the behaviour you have stated above, however, the same error was received in the Auth0 Logs which is expected behaviour.

Just to make sure that your configuration is correct:

  • The body of the Update User Flow on my end is as follows:
{
  "given_name": "{{fields.given_name}}",
  "family_name": "{{fields.family_name}}"
}

For the User ID field make sure you have used {{context.user.user_id}}. Also, make sure that you have used the proper text field ids in the Update User Flow.

  • I have used the same Post-Login Action code you have provided above and these were the id tokens available in the app:
  1. Login from user without given and family names:
{
  "sub": "auth0|{{user_id}{",
  "given_name": "Jack",
  "family_name": "Smith",
  "nickname": "test_one",
  "name": "test_one@test.email",
  "picture": "{{profilePicture_url",
  "updated_at": "2025-09-17T16:12:54.394Z"
}

2.Silent Login performed by application where the user did not have given and family name:

{
  "given_name": "Jack",
  "family_name": "Smith",
  "nickname": "test_user",
  "name": "test_user@test.com",
  "picture": "{{profilePicture_url}}",
  "updated_at": "2025-09-17T16:15:37.749Z",
  "email": "test_user@test.com",
  "email_verified": false,
  "sub": "auth0|{{user_id}}"
}

Otherwise, the error you received is expected because during Silent Authentication performed by the application, it initially fails because the user does not have the names set and the application must render the form in the Post-Login Action so that they can successfully authenticate again.

If you have any other questions, let me know!

Kind Regards,
Nik

Thank your reply.

Your comment helped pointed out but did not really fix my issue.

I had to do the following:

  • Put metadata at metadata level not root level, when I try to update given_name and family_name the flow fails with 400 because I need to provide all the data (email, email_verified, etc…).

  • My flow was not connected to my form (stupid me).

  • In the post login action I needed to add a step to add the metadata as custom claims for my idToken: api.idToken.setCustomClaim(‘metadata’, event.user.user_metadata) // add usermetadata in idToken

1 Like

Thanks for letting me know that you managed to solve the issue!

For future reference, if you wish to store that information in user metadata instead of the root level, that is not an issue, however, you are able to add this information to the root level nonetheless and it should be available and passed in the ID token without having to set them as custom claims.

If you ever have any other questions or issued, feel free to let us know by posting on the community!

Kind Regards,
Nik

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