Username authentication instead of email
Instead of using a method where you assign an email address for the user, it might be a better option to lookup an email address in your database.
An example would be:
- Prompt the username to login with username and password
- Verify the username exists in your database and retrieve the corresponding email address for that account
- Pass this email address to the login process seamlessly
There is no default username+password provider built into Firebase Authentication. But you can create your own custom identity provider using the instructions in the Firebase documentation. This requires code that runs in a trusted environment, for which you can use your own server or Cloud Functions for Firebase. There is now even an example of this in the functions-samples repo.
Alternatively: you can use the built-in email+password provider and simply add any domain behind the username. So once you have determined the user name, register your user with <username>@vikzillasapp.com
.
Note that this will make it impossible to for the user to reset their password if they forget it, since Firebase uses the email address to send the password reset email.