getUser
.
This script is required for automatic migration, and conditionally required for legacy authentication depending on the operations configured for the connection. To avoid creating duplicate users, set a consistent, unchanging user_id
on the returned user profile for the same user.
If automatic migration is configured for the connection and the user profile has not yet been created, the script is executed whenever the following operations occur:
getUser
function should:
getUser
function accepts two parameters and returns a callback
function:
Parameter | Type | Description |
---|---|---|
email | String | The user’s email address. |
callback | Function | Used to pass error or profile data through the pipeline |
getUser
function. For language-specific examples, read Language-specific script examples.
callback
function is used to pass user profile data or error data through the pipeline.
callback
function accepts up to two parameters and returns a function:
Parameter | Type | Required | Description |
---|---|---|---|
error | Object | Required | Contains error data. |
profile | Object | Optional | Contains the user’s profile data. |
null
value to the error
parameter, and pass the user’s profile data to the profile
parameter in normalized form. In addition to the standard fields, you can include the user_metadata
, app_metadata
, and mfa_factors
fields.
null
value to the error
parameter, and omit the profile
parameter.
error
parameter with relevant information about what went wrong. For more information, read Troubleshoot Custom Databases.