# setAppMetadata during Pre-User-Registration using passwordless connections

**URL:** <https://community.auth0.com/t/setappmetadata-during-pre-user-registration-using-passwordless-connections/75758>\
**Category:** Get Help\
**Created:** [January 3, 2022, 10:06pm UTC](https://community.auth0.com/t/setappmetadata-during-pre-user-registration-using-passwordless-connections/75758 "2022-01-03T22:06:10Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![bkensey](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/bkensey/32/34148_2.png) [@bkensey](https://community.auth0.com/u/bkensey)\
**Post date:** [January 3, 2022, 10:06pm UTC](https://community.auth0.com/t/setappmetadata-during-pre-user-registration-using-passwordless-connections/75758/1 "2022-01-03T22:06:10Z")

</div>

I’ve been having issues trying to populate metadata in a pre-user-registration action using a passwordless sms connection. I want to allow user signups but also check to see whether the user’s phone number has already been whitelisted on our application database with an invite. I stumbled across this topic explaining that it’s a known bug that api.user.setAppMetadata doesn’t fire during pre-registration using passwordless connections, which leads me to think that this is also true for setUserMetadata: [Adding user to default role, passwordless flow - #4 by mitchell.anderson](https://community.auth0.com/t/adding-user-to-default-role-passwordless-flow/63706/4)

Is this still an active issue, and if so, is there any information on when a fix might be coming? I don’t have a firm idea of how to alternatively implement this. Perhaps with an older hook or rule?

---

<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:** [January 4, 2022, 2:42am UTC](https://community.auth0.com/t/setappmetadata-during-pre-user-registration-using-passwordless-connections/75758/3 "2022-01-04T02:42:54Z")

</div>

Hi @bkensey,

Welcome to the Auth0 Community!

I have just tested the Pre-User Registration Hook and can confirm your observations.

Currently, this is a known bug and included in our Engineers backlog to fix once our code freeze has lifted. The freeze is anticipated to be lifted early in 2022.

For now, I recommend using a Rule or Action as a workaround. Take a look at this [Rule](https://auth0.com/docs/users/metadata/manage-metadata-rules#update-app-metadata) and [Action](https://auth0.com/docs/manage-users/user-accounts/metadata/manage-user-metadata) examples for details.

Hoped this answers your questions.

Please let me know if there’s anything else I can do to help.

Thanks.

---

<div class="post-metadata">

**Author:** ![bkensey](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/bkensey/32/34148_2.png) [@bkensey](https://community.auth0.com/u/bkensey)\
**Post date:** [January 5, 2022, 12:27am UTC](https://community.auth0.com/t/setappmetadata-during-pre-user-registration-using-passwordless-connections/75758/5 "2022-01-05T00:27:26Z")

</div>

To be clear, I was trying to use the pre registration action, not the hook, but after time spent today on this it appears that the hook is also affected by this bug.

---

<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:** [January 5, 2022, 5:58pm UTC](https://community.auth0.com/t/setappmetadata-during-pre-user-registration-using-passwordless-connections/75758/6 "2022-01-05T17:58:16Z")

</div>

Hi @bkensey,

Thank you for your clarification.

I should have been clearer that both Actions and Hooks share the same functionality and are affected by this issue.

Nonetheless, I have reported the issue to our Engineers, and we expect it to be fixed after the code freeze is removed.

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:** [January 20, 2022, 5:58pm UTC](https://community.auth0.com/t/setappmetadata-during-pre-user-registration-using-passwordless-connections/75758/7 "2022-01-20T17:58:54Z")

</div>

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

---

<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:** [May 12, 2023, 11:40am UTC](https://community.auth0.com/t/setappmetadata-during-pre-user-registration-using-passwordless-connections/75758/8 "2023-05-12T11:40:53Z")

</div>



---

<div class="post-metadata">

**Author:** ![severin1](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@severin1](https://community.auth0.com/u/severin1)\
**Post date:** [May 12, 2023, 11:15am UTC](https://community.auth0.com/t/setappmetadata-during-pre-user-registration-using-passwordless-connections/75758/9 "2023-05-12T11:15:41Z")

</div>

Is this issue still open?  
[https://community.auth0.com/t/setappmetadata-during-pre-user-registration-using-passwordless-connections/75758?u=severin1](https://community.auth0.com/t/setappmetadata-during-pre-user-registration-using-passwordless-connections/75758)

---

<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:** [May 12, 2023, 11:41am UTC](https://community.auth0.com/t/setappmetadata-during-pre-user-registration-using-passwordless-connections/75758/10 "2023-05-12T11:41:22Z")

</div>

Hey there @rueben.tiow !

Would you be able to follow up on that? Thanks!

---

<div class="post-metadata">

**Author:** ![severin1](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@severin1](https://community.auth0.com/u/severin1)\
**Post date:** [May 12, 2023, 12:06pm UTC](https://community.auth0.com/t/setappmetadata-during-pre-user-registration-using-passwordless-connections/75758/11 "2023-05-12T12:06:56Z")

</div>

Yes, thank you!  
I just invested more time into debugging my issue.  
It seems like the Action is executed (I see Real-time Webtask Logs)

But when the user is created, the app\_metadata is empty.

---

<div class="post-metadata">

**Author:** ![severin1](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@severin1](https://community.auth0.com/u/severin1)\
**Post date:** [May 12, 2023, 12:09pm UTC](https://community.auth0.com/t/setappmetadata-during-pre-user-registration-using-passwordless-connections/75758/12 "2023-05-12T12:09:50Z")

</div>

This is essentially my action:

```auto
exports.onExecutePreUserRegistration = async (event, api) => {
  const adminIds = await getFamilyAdmins(event); // returns an array of ids

  for (const adminId of adminIds) {
    const familyKey = `family_${adminId}`;

    console.log(adminId); // this gets executed

    api.user.setAppMetadata(familyKey, "value");
  }
};

```

But in the Auth0 Management Console, app\_metadata is still an empty object `{ }`

---

<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:** [May 17, 2023, 6:03pm UTC](https://community.auth0.com/t/setappmetadata-during-pre-user-registration-using-passwordless-connections/75758/13 "2023-05-17T18:03:55Z")

</div>

Hi @severin1,

Thank you for your response.

I have just tested the `api.user.setAppMetadata()` method in a PreUserRegistration Action flow and did not encounter any issues. I could successfully set the app\_metadata for the user.

After testing your script myself, I could set the user app\_metadata and the result is below:  
 ![image](https://global.discourse-cdn.com/auth0/original/3X/d/b/db112ddaf979eeca2a8ec3384d48d8d50d1ab02b.png)

Please note that I used the integers 1 to 5 for my array of IDs for testing. Everything works as expected.

With that, I can confirm that the PreUserRegistration Action flow can set the app\_metadata and that your script has no issues.

Now, could you please re-confirm if this is your observation as well?

Thanks,  
Rueben

---

<div class="post-metadata">

**Author:** ![amit.chavhan](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/amit.chavhan/32/39540_2.png) [@amit.chavhan](https://community.auth0.com/u/amit.chavhan)\
**Post date:** [September 19, 2023, 4:41pm UTC](https://community.auth0.com/t/setappmetadata-during-pre-user-registration-using-passwordless-connections/75758/14 "2023-09-19T16:41:47Z")

</div>

In my case pre-user-registration is not even being triggered during the time auth0 sends SMS or after the client calls for the access token. Does auth0 support pre-user-registration action for passwordless SMS connection?

---

<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:** [September 19, 2023, 6:36pm UTC](https://community.auth0.com/t/setappmetadata-during-pre-user-registration-using-passwordless-connections/75758/15 "2023-09-19T18:36:02Z")

</div>

Hi @amit.chavhan,

Yes, the Pre-User Registration Action triggers for both Database and Passwordless connections.

 ![image](https://global.discourse-cdn.com/auth0/original/3X/5/3/53b052159bdc54218476a23d5e349809f8ddab32.png)  
(Reference:[Pre User Registration Flow](https://auth0.com/docs/customize/actions/flows-and-triggers/pre-user-registration-flow))

I recommend using `console.log()` statements in your action script with the [Real-time Webtask Logs Extension](https://auth0.com/docs/customize/extensions/real-time-webtask-logs) to track if the script is being triggered in your flow or any errors you may have.

Thanks,  
Rueben

---

<div class="post-metadata">

**Author:** ![amit.chavhan](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/amit.chavhan/32/39540_2.png) [@amit.chavhan](https://community.auth0.com/u/amit.chavhan)\
**Post date:** [September 19, 2023, 6:40pm UTC](https://community.auth0.com/t/setappmetadata-during-pre-user-registration-using-passwordless-connections/75758/16 "2023-09-19T18:40:10Z")

</div>

@rueben.tiow Thank you so much, I can see logs coming from the extension you suggested. Can you tell me why action logs are not part of the regular logs?

---

<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:** [September 19, 2023, 11:45pm UTC](https://community.auth0.com/t/setappmetadata-during-pre-user-registration-using-passwordless-connections/75758/17 "2023-09-19T23:45:03Z")

</div>

Hi @amit.chavhan,

The Action logs are also part of the regular logs. You can see them on the **Action Details** section of your logs.

![image](https://global.discourse-cdn.com/auth0/original/3X/5/e/5e214988dae9f517293b7be1dc1259df07e66eda.png)

Thanks,  
Rueben

---

<div class="post-metadata">

**Author:** ![jieo](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jieo/32/49560_2.png) [@jieo](https://community.auth0.com/u/jieo)\
**Post date:** [September 20, 2023, 3:28pm UTC](https://community.auth0.com/t/setappmetadata-during-pre-user-registration-using-passwordless-connections/75758/19 "2023-09-20T15:28:01Z")

</div>

I am facing the same issue. I can see logs from pre-user-registration actions in Real-time Webtask Logs Extension , but the action is not in in regular logs. This is a for a passwordless email signin.

---

<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:** [September 20, 2023, 4:51pm UTC](https://community.auth0.com/t/setappmetadata-during-pre-user-registration-using-passwordless-connections/75758/20 "2023-09-20T16:51:03Z")

</div>

Hi @jieo,

After doing some tests myself, I can confirm that the Pre-User Registration Action logs do not appear in the regular logs for a Passwordless Email login.

I have reached our to our Engineering and Product teams regarding this and I will follow up once I have an update.

Thanks,  
Rueben

---

<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:** [January 9, 2024, 7:55pm UTC](https://community.auth0.com/t/setappmetadata-during-pre-user-registration-using-passwordless-connections/75758/23 "2024-01-09T19:55:51Z")

</div>

Hi all,

Update: Passwordless login does not support an explicit sign up flow, so each login is a mix of sign up and login. Hence why the Pre-User Registration action logs do not appear in the regular logs for Passwordless email.

Thanks,  
Rueben
