Using "username" in the context of a "custom database"

Just searched the forum for my problem on custom databases related to the use of a username (“Requires the user to provide a username in addition to email.”) There are already entries on this topic, but no apparent solution – or at least explanation.

My question:
In the Database Action Scripts, only the user’s email address is ever passed in the functions. Especially if I have set the username-checkbox, I would actually always expect the “username” here.

Here the method signature of the action Get User is:

function loginByEmail(email, callback) {}

Also the function of Change Password always gets passed only the email address:

function changePassword(email, newPassword, callback) {}

Or am I missing something obvious?

Thanks for your time,
Peer

Hi @connectionreset,

Welcome to Auth0 Community!

If you have Requires Username enabled for a custom database connection, you will need to then add the the username property to the Login and Get User scripts.

You should see an error message “DB Login Custom script: username is required” if you have it missing from these scripts when Requires Username is enabled.

Hope this helps!

Thanks,
Dave

2 Likes

Hello Dave,

thank you very much for your answer.

Have now implemented a solution based on “Organizations”. Think I will stick with it.

Kind regards
Peer

1 Like