Pre registration hook bug setting user metadata in passwordless context?

Hi,

I’ve seen this message from @guy1812 Pre registration hook set non-metadata user info? - #25 by guy1812, 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.

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

2 Likes

Thanks for sharing that with the rest of community!

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

Just for you :slight_smile:

2 Likes

Thanks for sharing that with the rest of community!

1 Like

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 :ok_hand:

@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

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

1 Like

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