Set a user_id in a Pre-Registration Hook

Overview

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'

 

Symptoms

Custom user_id cannot be set by pre-registration hook.

 

Applies To
  • User ID 
  • Pre-Registration Hook
Cause

Unsupported feature.

 

 

Solution
Workaround is to 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 in some flows cause them to be merged, so I would recommend giving it a unique name in the app_metadata, e.g. "custom_user_id". Please see the link below for more information:

Recommended content

No recommended content found...