Authenticate Using Phone, Username And Password In Firebase

I have a requirement where a user can enter their phone number, a username and a password in the sign up screen. The user should get an sms to enter the pin, and the account should be created with the username and password. When they login back, they can enter their phone number and the password to enter the app.

In my previous projects, I have individually implemented phone auth and username + password auth but I have never came across a combination between those two.

Is this something doable? Or do I have to use a custom authentication for Firebase? Any recommendation would be greatly appreciated.




you can firebase client sdk to implement this requirement.

But the sign up and login will work in 2 different ways.

You must enable phone, email/password feature.

during the sign up/login you need to send the verification code to the phone number and
the password auth can be programmed easily depending upon what client you are using.

Since you already done this it will be easy for you it seems


well for one case you could store the username, password and phone number in firebase. so when the user gets an sms and verify on that you could create a username and password signup (but i don't see one so what you must do is append at the end of the username to make it like a email, and you can perfectly do this since you don't have email related things in your app).

Now when they login using their phone number you can map that email related to that phone number and use signInWithEmailAndPassword feature in client sdk with the password associated with the phone number and thus in the front end it may seems that you are logging in using phone number but in the back end you have extra layer of authenticity via phone-email-password combination.

I believe now you got me.