# Pre registration hook bug setting user metadata in passwordless context?

**URL:** <https://community.auth0.com/t/pre-registration-hook-bug-setting-user-metadata-in-passwordless-context/60948>\
**Category:** Get Help\
**Tags:** hooks, passwordless\
**Created:** [April 12, 2021, 9:24am UTC](https://community.auth0.com/t/pre-registration-hook-bug-setting-user-metadata-in-passwordless-context/60948 "2021-04-12T09:24:54Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![shouze](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/shouze/32/28734_2.png) [@shouze](https://community.auth0.com/u/shouze)\
**Post date:** [April 12, 2021, 9:24am UTC](https://community.auth0.com/t/pre-registration-hook-bug-setting-user-metadata-in-passwordless-context/60948/1 "2021-04-12T09:24:54Z")

</div>

Hi,

I’ve seen this message from @guy1812[Pre registration hook set non-metadata user info? - #25 by guy1812](https://community.auth0.com/t/pre-registration-hook-set-non-metadata-user-info/32549/25), is it a real bug or not? @dan.woda or @James.Morrison any update on this? Because unfortunately we’ve reproduced it past friday.

Anyway I can explain what we want to achieve so far and maybe you can suggest us to do it another way or with a workaround the way we want to do it?

We want to send a request to some of our backends whith the generated auth0 user id on passwordless registration in order to return our external user identifier and get it stored into auth0 user profile, in order to have it embedded into the JWT id token. Thus when we do requests thereafter on our own api whith this JWT id token it will embed both auth0 id and our external user id which is the one we care of.

---

<div class="post-metadata">

**Author:** ![guy1812](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/guy1812/32/18251_2.png) [@guy1812](https://community.auth0.com/u/guy1812)\
**Post date:** [April 12, 2021, 10:15am UTC](https://community.auth0.com/t/pre-registration-hook-bug-setting-user-metadata-in-passwordless-context/60948/2 "2021-04-12T10:15:53Z")

</div>

I have done the same when I managed a mobile app with auth0 authentication and connected each user to its CRM’s identifier. for me the connection field was the phone number (for SMS passwordless).

u can use post login Rule - auth0 will call your backend with some fields and get back the external user ID, then save the external user id on the auth0 user metadata.

then if u want to get this data on the IDToken auth inside your JWT you need another rule to save from the user\_metadata into the IDTOKEN.  
If u need more help I can send u the code… [Guy-Avraham.com](http://Guy-Avraham.com)

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [April 12, 2021, 10:36am UTC](https://community.auth0.com/t/pre-registration-hook-bug-setting-user-metadata-in-passwordless-context/60948/3 "2021-04-12T10:36:10Z")

</div>

Thanks for sharing that with the rest of community!

---

<div class="post-metadata">

**Author:** ![shouze](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/shouze/32/28734_2.png) [@shouze](https://community.auth0.com/u/shouze)\
**Post date:** [April 12, 2021, 12:31pm UTC](https://community.auth0.com/t/pre-registration-hook-bug-setting-user-metadata-in-passwordless-context/60948/4 "2021-04-12T12:31:26Z")

</div>

Ho yes I’m ok if you can share us the code of the 2 rules you’ve implemented, could save us some time 😀

---

<div class="post-metadata">

**Author:** ![guy1812](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/guy1812/32/18251_2.png) [@guy1812](https://community.auth0.com/u/guy1812)\
**Post date:** [April 13, 2021, 11:28am UTC](https://community.auth0.com/t/pre-registration-hook-bug-setting-user-metadata-in-passwordless-context/60948/5 "2021-04-13T11:28:15Z")

</div>

> **[Auth0 working with external identifiers](https://guy-avraham.medium.com/auth0-working-with-external-identifiers-661699da5695)**
>
> A short explanation on

Just for you 🙂

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [April 13, 2021, 12:02pm UTC](https://community.auth0.com/t/pre-registration-hook-bug-setting-user-metadata-in-passwordless-context/60948/6 "2021-04-13T12:02:08Z")

</div>

Thanks for sharing that with the rest of community!

---

<div class="post-metadata">

**Author:** ![armand.abric](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/armand.abric/32/12742_2.png) [@armand.abric](https://community.auth0.com/u/armand.abric)\
**Post date:** [April 13, 2021, 1:55pm UTC](https://community.auth0.com/t/pre-registration-hook-bug-setting-user-metadata-in-passwordless-context/60948/7 "2021-04-13T13:55:57Z")

</div>

Thanks for this example! I’m working with @shouze on an Auth0 integration and it helps us a lot to understand how Auth0 works. We now have an external id attached to our user with a dedicated rule 👌

@konrad.sopala The docs said that we could also edit user metadata (or app metadata) with a hook or an action. But we did not succeed to make it works even with the simplest example of the documentation: [https://auth0.com/docs/hooks/extensibility-points/pre-user-registration#sample-script-add-metadata-to-new-users](https://auth0.com/docs/hooks/extensibility-points/pre-user-registration#sample-script-add-metadata-to-new-users)

Did you know if there are an issue on this feature?

---

<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 28, 2021, 1:56pm UTC](https://community.auth0.com/t/pre-registration-hook-bug-setting-user-metadata-in-passwordless-context/60948/8 "2021-04-28T13:56:37Z")

</div>

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