Problem Statement
We are trying to set a specific user_id in a pre-registration hook. But each time the id of the created user is overwritten by an id generated by Auth0. How could we keep the user_id we set?
We tried the following options : user.id = ‘xxx’ / user.user_id = ‘xxx’ / response.user.user_id = ‘xxx’ / response.user.id = ‘xxx’
Solution
Currently, setting user_id in the pre-registration hook is not supported. Please communicate your use case with our Product team via the feedback page.
As a workaround, you can add the custom ID into the user’s app_metadata , and then add this as a claim in tokens, for example, so it is exposed to your applications.
Please note that using the same name as an existing profile field can cause them to be merged in some flows, so we recommend giving it a unique name in the app_metadata, e.g. “custom_user_id”.
Please see the link below for more information: