I am using a custom database, where my database uses a username[not email] and password to authenticate the user. Now how can we pass the username in the login script? I am disabling import user so all the get and create script will execute accordingly
You should be able to use the email in the login script as either the email or username of a user, and then include the username in the profile returned. I should note that if you do decide to turn import mode on, these users will need a unique email address for their Auth0 profile as that is a requirement.
Because while triggering create operation it triggers the following script asynchronously. Now in get user I need to pass get used by any other user attribute[suppose I have a username in my external db] but the template doesnt contain that field. So how to catch that value within the get script
Yes, additional logic is necessary to add in the get user script, login script, but how to add that logic, auth0 has given us the template where only email can be used, and replacing and adding username parameter is not working here.
If you are wanting to create new users with the create script, you will need to include a unique email for the user as well. If you have import mode off and Require Username enabled, the get_user script will actually only use the email. We have a backlog item in to address that the get_user script does not run again with a username, though we do not have an ETA for that at the moment. The workaround would be to use the get_user script to validate existing emails, but would only validate for existing username in the create script logic .
I also wanted to share this link to another community post that covers how your Custom DB scripts to be able to handle the email parameter being passed as either an email or a username: Username does not work for custom mongodb connection
Updating this topic with our latest solution that makes it possible to create an account with flexible identifiers → Activate and Configure Attributes for Flexible Identifiers. You can select between Email, Phone, or Username as Identifiers for your database connection.