How to Identify if the GetUser Custom DB Script Accepts Email or Username when the Custom DB has Username Enabled

Problem statement

The GetUser custom DB script only accepts email and callback as the function parameters.

This article addresses the following question:

  • Does Auth0 always provide the email to this script in the signup flow, or does it sometimes provide the username?


The parameter to the GetUser script could be either email or username based on what is entered by the user on the login screen. In case a custom DB has username enabled, the GetUser and login script should first check if the email parameter is an email or username and configure the logic accordingly.

Since a connection in Auth0 can not have two users with the same email, it is recommended that the GetUser script provides an email to be checked against the legacy DB.