# No context.renderLanguage or context.request.language in Pre User Registration hook after /passwordless/start

**URL:** <https://community.auth0.com/t/no-context-renderlanguage-or-context-request-language-in-pre-user-registration-hook-after-passwordless-start/55894>\
**Category:** Get Help\
**Tags:** hooks\
**Created:** [January 8, 2021, 2:50pm UTC](https://community.auth0.com/t/no-context-renderlanguage-or-context-request-language-in-pre-user-registration-hook-after-passwordless-start/55894 "2021-01-08T14:50:54Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![norbert.schuler](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/norbert.schuler/32/26799_2.png) [@norbert.schuler](https://community.auth0.com/u/norbert.schuler)\
**Post date:** [January 8, 2021, 2:50pm UTC](https://community.auth0.com/t/no-context-renderlanguage-or-context-request-language-in-pre-user-registration-hook-after-passwordless-start/55894/1 "2021-01-08T14:50:54Z")

</div>

I wrote a Pre User Registration hook to add the user locale/language to the user meta data in order to send out a localized mail with the verification code , but I could not retrieve a value from `context.renderLanguage` nor from `context.request.language` within this hook after triggering the API call [/passwordless/start](https://auth0.com/docs/api/authentication#get-code-or-link) despite I also added an authParams parameter with `ui_locales: de` inside - here is my hook code:

```
module.exports = function (user, context, cb) {
  var response = {};
  user.user_metadata = user.user_metadata || {};
  user.user_metadata.emailVerificationSentDate = new Date().valueOf();
  console.log(`Set emailVerificationSentDate to ${user.user_metadata.emailVerificationSentDate}`);
  user.user_metadata.lang = context.renderLanguage || context.request.language || 'en';
  console.log(`Set lang to ${user.user_metadata.lang}`);
  response.user = user;
  cb(null, response);
};

```

If I am using the normal Auth0 dialog for signup, a value for `context.renderLanguage` is available. But how can I transfer the user locale using passwordless signup by directly calling the API (not using any Auth0 UI). In fact I do not really wanted to directly use the Auth0 API, but have tried to use [GitHub - auth0/react-native-auth0: React Native toolkit for Auth0 API](https://github.com/auth0/react-native-auth0).

---

<div class="post-metadata">

**Author:** ![stephanie.chamblee](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/stephanie.chamblee/32/26087_2.png) [@stephanie.chamblee](https://community.auth0.com/u/stephanie.chamblee)\
**Post date:** [January 8, 2021, 9:01pm UTC](https://community.auth0.com/t/no-context-renderlanguage-or-context-request-language-in-pre-user-registration-hook-after-passwordless-start/55894/3 "2021-01-08T21:01:14Z")

</div>

Hi @norbert.schuler,

Welcome to the Community!

I’m looking into this now, and will let you know what I find.

Thanks,

Stephanie

---

<div class="post-metadata">

**Author:** ![norbert.schuler](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/norbert.schuler/32/26799_2.png) [@norbert.schuler](https://community.auth0.com/u/norbert.schuler)\
**Post date:** [January 9, 2021, 1:07pm UTC](https://community.auth0.com/t/no-context-renderlanguage-or-context-request-language-in-pre-user-registration-hook-after-passwordless-start/55894/4 "2021-01-09T13:07:04Z")

</div>

Thank you for investigating this. I just recognized I do not know if it even makes sense to try to store the language in the user metadata in a Pre User Registration hook as the user account maybe does not exists at that time. I want to store it in order to localize the email for the one-time password authentication of a user like this:

 ![Bildschirmfoto 2021-01-09 um 14.01.09](https://global.discourse-cdn.com/auth0/original/3X/7/4/74da08722e07675ad24972c2d75e31d275a26ab9.png)

Is there another way to retrieve the user’s language for this and other mail templates?

---

<div class="post-metadata">

**Author:** ![norbert.schuler](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/norbert.schuler/32/26799_2.png) [@norbert.schuler](https://community.auth0.com/u/norbert.schuler)\
**Post date:** [January 11, 2021, 1:24pm UTC](https://community.auth0.com/t/no-context-renderlanguage-or-context-request-language-in-pre-user-registration-hook-after-passwordless-start/55894/5 "2021-01-11T13:24:05Z")

</div>

We will use the solution described at [https://auth0.com/docs/connections/passwordless/guides/email-otp](https://auth0.com/docs/connections/passwordless/guides/email-otp) for now taking the locale from the `request_language` directly in the email template with e.g. `{% if request_language contains 'de' %}`. That’s at least better then no localization.

---

<div class="post-metadata">

**Author:** ![stephanie.chamblee](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/stephanie.chamblee/32/26087_2.png) [@stephanie.chamblee](https://community.auth0.com/u/stephanie.chamblee)\
**Post date:** [January 11, 2021, 1:32pm UTC](https://community.auth0.com/t/no-context-renderlanguage-or-context-request-language-in-pre-user-registration-hook-after-passwordless-start/55894/6 "2021-01-11T13:32:01Z")

</div>

I’m glad you found a solution! Yes, when `/passwordless/start` is called with the `x-request-language` specified in the request header, the passed language will be available. Otherwise, the user’s browser language will be used for the `request_language` variable.

---

<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 26, 2021, 1:32pm UTC](https://community.auth0.com/t/no-context-renderlanguage-or-context-request-language-in-pre-user-registration-hook-after-passwordless-start/55894/7 "2021-01-26T13:32:06Z")

</div>

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