Couldn't find any questions like this. In my app I want to give users the ability to log-in through either phone/password or email/password. What is the best way to do that? I'm using firebase for authentication and database/storage.
Log in through either email or phone
Database & APIs
From my understanding, one way I thought of to do this was as follows:
Have two fields on login page, phone/email and password
In actions, check if the first field matches either a phone mask or email mask
Go through the entire firebase, to find that email/phone and then check if the password fits. I have no idea how access rules would work then, as I have an unathenticated user check for both email/phone and password. I also feel there are other problems with this that I'm not seeing.
I'm worried this is too complicated and might be slow if there's a lot of users in the database. Would it be easier with some other authentication service? Has anyone else done this? And how do I register a user?
Yes
1
5 replies