Auth0 Invokes GetUser Script When Sending Verification Emails
Last Updated:
Overview
When a verification email is sent to a user for a custom database connection, Auth0 first executes a script to confirm the user's existence. If this script returns an email address that differs from the one initially requested, the script will use the provided email address instead.
Applies To
- Actions
- Custom database
Cause
In this scenario, the script is executed immediately when a verification email is triggered. If the email returned by the script differs from the submitted email, the script's email will be used instead. This is because the upstream connection is regarded as the source of truth.
Solution
If the getUser script returns a null result, Auth0 will use the email address specified directly in the payload script. Conversely, if the getUser script successfully retrieves a user profile, Auth0 will use the email address in that profile to route the verification message.
To address the issue, please adhere to the following steps:
- Review the configuration of the custom database connection script to ensure the returned email address matches the intended recipient.
- Access the
getUserscript within the custom database connection. - Assess the logic to confirm that it accurately returns the user profile.
- Verify that the script provides the correct email address for the user.