Firebase Phone Number Authentication Scenario - firebase

I want to add one main user with email and password
I want to also register users under main user with phone number verification, but I want to provide this only to allowed set of phone numbers who I got registered
kindly guide how I proceed with this
i m using react-native for mobile application
thanks
i have read lot of articles but could not help

Related

Firebase change authentication type email to phone

I developed a ionic 5 angular based mobile app that uses firebase authentication. I currently use email based login and now i want to switch to phone number based one. Is there any option to verify all the already registered users's phone number using firebase or any other service?
There is no way to change the authentication type of an existing account. But what you can do is also allow the user to sign in with their phone number, and then link the phone number credentials to their existing account.
For full details on how to do this, see the Firebase documentation on linking multiple auth providers to an account.

How to reauthenticate user who signed in with phone number in firebase?

Hi I need to add the option for users to delete their accounts from within the app but I just don´t know how to do it, I found some information here where it explains that we need to ask the user to sign in again otherwise we´ll get an error, but it only explains how to reauthenticate the user when this signed in using an email address and it does not say anything about when a phone number was used instead.

firebase users login through mobile

I'd like to know if it's possible for a mobile registered firebase user to log-in without authentication procedure, in other words:
Lets say an administrator creates a firebase user by console (or web interface to console) then is it possible that when this user launches the app on his mobile he just logs in without the authentication procedure?
To put it simple, is it possible for mobile users a log-in like email/password user: just enter the number and log-in?
If you're referring to using a Phone Number for authentication this is supported by Firebase and the documentation can be found here https://firebase.google.com/docs/auth/ios/phone-auth
The caveat to this is that you can't create a user through the Firebase console as you were suggesting. It relies on the user using their mobile number to register when they logging in for the first time.
The other option that may or may not be applicable is to use Anonymous authentication along with a collection of predefined users with numbers as Peter suggested above.
You can add new users from the console, first you need to enable the email/password Sign in method. Then you can add a new user:
Then the user can login using the email/password added in the console.
If you want the user to enter a number and login, then associate a number in the firebase database with the email:
Users
userid
email: userx#gmail.com
number: 102

disable sign up with signInWithPhoneNumber in fireabase

I just use two methods on my web app.
SignInWithEmail
SignInWithPhoneNumber
And I want users can sign up with user&password which is possible now and then I get their phone number. So they can sing in with the phone number for the next time. But if someone put an unexcited phone number in sign in page it didn't show an error to say that phone number doesn't exist. And firebase just signed up that phone number!
I just want users could sign up for email and password!
SignInWithPhoneNumber method will automatically sign up a new user if user doesn't exist. You can check if the returned user is a new user and if it's new, delete and sign out the user manually.
Firebase Auth provides the tools needed for building this. As Ti pointed it out, Firebase Auth returns isNewUser in firebase.auth.UserCredential returned on sign in/sign up. You can inspect that to tell if a phone number user is existing or new and wire your logic from there. You also have the ability to ask the user to provide their email/password afterwards. You can use linkWithCredential to link an email/password credential.

How to allow user to sign in with both email and phone number?

I have firebase name and email authentication in my android app. I also have phone number auth in my app.
I want to link name and email with phone, so that user can sign in with phone number and password, if he forgets email or gets bore to type long email.
Depending on whether you want to allow for signing in with either email or phone number, or if you want to allow for the Phone number to be used as a second factor, for sign in, there are different solutions.
If you just want to have the Phone number be a second way to sign in, you can link the credentials using the linkWithCredential method on your Firebase User. This way you can add as many ways to sign in, as you want. Firebase has a good guide on this.
If you want the phone number to be a second factor of authentication, you will need to have a custom auth provider, which does the second factor authentication. There is also a getting started guide on this, however the 2 Factor Authentication part itself would be up to you.

Resources