This article explains how to overcome the scenario where a Passwordless user (who already exists in the tenant) logs in, and the Pre/Post User Registration action runs for each login.
Applies To
Pre/Post User Registration Actions
Solution
This issue was solved by creating a new feature flag. If needed, please open a support ticket with the tenant’s name to have the feature enabled.
I have run into the exact same issue with the Pre UserRegistration hook/custom action runs even when the user tries to login, where the login method is Passwordless + SMS.
The use case is fetching an external User Id and setting that value in the user’s metadata.
I am also having issues with the api.setUserMetadata method. It does not work as excepted. The registered user’s metadata is empty.
Thanks, and yes the Custom Action has been attached to the Pre Registration Flow. I am able to get logs out of the Custom Action using the Auth0 Logs Extension. I can even log the body of the metadata I wish to persist. Unfortunately, when I inspect the body of the user’s metadata afterwards, it is empty.
I’ve heard back from Engineering that there is a known limitation in the pre-user registration action trigger that it will not set metadata using api.setUserMetadata when using the Passwordless OTP flow. The documentation will be updated soon to clarify this limitation. There is also an item to fix this limitation, however, I don’t have a specific release date for when it will be resolved.
I’m experiencing the same bug, the pre-registration actions trigger when a user attempts to login using passwordless login. I have an action that denies access if a user is registered with an existing email which is obviously triggered on login since the user is logging in with an existing account. Am I misunderstanding the flows? I had assumed pre-registration would only run when I called for example management.users.create.