# How do I update user metadata in signup flow?

**URL:** <https://community.auth0.com/t/how-do-i-update-user-metadata-in-signup-flow/119378>\
**Category:** Get Help\
**Tags:** users, management-api\
**Created:** [October 25, 2023, 2:32pm UTC](https://community.auth0.com/t/how-do-i-update-user-metadata-in-signup-flow/119378 "2023-10-25T14:32:28Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![dnationalwala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dnationalwala/32/49974_2.png) [@dnationalwala](https://community.auth0.com/u/dnationalwala)\
**Post date:** [October 25, 2023, 2:32pm UTC](https://community.auth0.com/t/how-do-i-update-user-metadata-in-signup-flow/119378/1 "2023-10-25T14:32:29Z")

</div>

- We are using passwordless (email) authentication
- We are passing language as query string (ui\_locales=fr-CA) to login url
  - This can render the login page in french language
  - However the email verification is still sent to english language
  - We tried to set the user meta data in post sign up action ([onExecutePostUserRegistration.js · GitHub](https://gist.github.com/dnationalwala-pm/f03704161b718432bb4f787583653800))
    - However it error out with message that user doesn’t exist

  - We found an [article](https://community.auth0.com/t/passwordless-auth-email-language-with-x-request-language-request-language/82879) where we can use ‘request\_language’ to set the email language.
    - How do we pass ‘x-request-language’ to var lock = new Auth0LockPasswordless() in our login page?

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [October 26, 2023, 3:51pm UTC](https://community.auth0.com/t/how-do-i-update-user-metadata-in-signup-flow/119378/3 "2023-10-26T15:51:59Z")

</div>

Hi @dnationalwala,

To update the user\_metadata in the signup flow, please use a [Pre-User Registration Action](https://auth0.com/docs/customize/actions/flows-and-triggers/pre-user-registration-flow).

For example:

```auto
/**
 * @param {Event} event - Details about registration event.
 * @param {PreUserRegistrationAPI} api
 */
exports.onExecutePreUserRegistration = async (event, api) => {
  api.user.setUserMetadata("locale", "fr-CA");  
};

```

(Reference: [Pre User Registration Flow](https://auth0.com/docs/customize/actions/flows-and-triggers/pre-user-registration-flow#set-metadata-in-the-user-profile))

Then to set your preferred language in the email template, please refer to this solution [here](https://community.auth0.com/t/how-to-detect-language-in-the-email-template-such-as-for-change-password/15896).

Please let me know if you have any questions.

Thanks,  
Rueben

---

<div class="post-metadata">

**Author:** ![dnationalwala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dnationalwala/32/49974_2.png) [@dnationalwala](https://community.auth0.com/u/dnationalwala)\
**Post date:** [October 26, 2023, 4:12pm UTC](https://community.auth0.com/t/how-do-i-update-user-metadata-in-signup-flow/119378/4 "2023-10-26T16:12:54Z")

</div>

Hi Rueben,

Thank you for your reply.

```auto
exports.onExecutePreUserRegistration = async (event, api) => {
  api.user.setUserMetadata("locale", "fr-CA"); 
};

```

This could not update metadata for user that is created with passwordless email.

Is there alternative for passwordless authentication?

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [October 26, 2023, 10:57pm UTC](https://community.auth0.com/t/how-do-i-update-user-metadata-in-signup-flow/119378/5 "2023-10-26T22:57:45Z")

</div>

Hi @dnationalwala,

Thanks for the reply.

With Passwordless email, we will need to use a Post-Login Action script to check for the user’s first login attempt. Let me add that whenever a user signs up they are automatically logged in. Leveraging this, we can set the user metadata on their first login attempt.

For example:

```auto
exports.onExecutePostLogin = async (event, api) => {
  if(event.stats.logins_count === 1){
    api.user.setUserMetadata("locale", "fr-CA"); 
  }
};

```

Thanks,  
Rueben

---

<div class="post-metadata">

**Author:** ![dnationalwala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/dnationalwala/32/49974_2.png) [@dnationalwala](https://community.auth0.com/u/dnationalwala)\
**Post date:** [October 26, 2023, 11:06pm UTC](https://community.auth0.com/t/how-do-i-update-user-metadata-in-signup-flow/119378/6 "2023-10-26T23:06:27Z")

</div>

Hi Rueben,  
Thank you for your reply.  
Post login event is triggered after the email is sent in English language.

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [October 31, 2023, 5:05pm UTC](https://community.auth0.com/t/how-do-i-update-user-metadata-in-signup-flow/119378/7 "2023-10-31T17:05:13Z")

</div>

Hi @dnationalwala,

Thanks for the reply.

> [@dnationalwala](#):
>
> Post login event is triggered after the email is sent in English language.

There are dependencies happening with your current flow that is limiting how the language can be set in the user\_metadata. Specifically, this is a synchronous flow where the passwordless user must first sign up, before you can update the user\_metadata. Because of this, there isn’t any way to prevent sending the verification email in English.

However, you could work around this by creating the user on their behalf and setting the user\_metadata using the Management API [Create a user endpoint](https://auth0.com/docs/api/management/v2/users/post-users).

This way, after the user is created, the correct user\_metadata value is set, and the verification email template can set the correct language accordingly and send it to the user.

---

<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:** [April 30, 2025, 11:55pm UTC](https://community.auth0.com/t/how-do-i-update-user-metadata-in-signup-flow/119378/9 "2025-04-30T23:55:43Z")

</div>

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