i have Google sign-in in the Logins screen, and i have another page to verify the user phone number.
I have use firebase Phone auth to verify phone number but it change the FirebaseAuth.currentUser from google uid to phone authentication uid, which is not what i want.
so i found a package flutter_otp but this plugin is not working fine.
so i want to send SMS otp and verify it without firebase.
Thanks
Related
In Firebase i can only login and register with email/password.
Also using phone number/ OTP to register, login.
How about login with phone number and password?
Did i missing some information or courses?
I am using firebaseui to log in users with google login. I am getting all other details but phoneNumber is returning null. Does google allow to get a phone number after google log in? or should I have to go for phone authentication to get phone number of users
Thanks in advance
The User.phoneNumber property is only populated when you use a phone number to sign in to Firebase. From that documentation:
This is null if the user has no phone credential linked to the account.
Firebase Authentication does not request the phone number from users' Google accounts.
I don't want to authenticate the user via their phone number that I have already done by using their email id and password. I just want to confirm that they are entering a valid phone number by sending them an OTP and verifying it. All the solutions that I have looked up go on to straight up authenticate the user. I am using firestore as my database.
Firebase allows you to link multiple authentication methods. You can find more details at https://firebase.google.com/docs/auth/web/account-linking
So, once the user is authenticated with email/password, initiate phone number authentication. When you get AuthCredential link it to current firebase user as mentioned in above link.
Other solutions would be to use external SMS gateway like twilio and doing phone number verification on your own. Which isn't required for your use case. In case you still want to try this, there is a free SMS gateway (which uses your own mobile number to send SMS) at https://www.sg.yagnyam.in/.
Can I use the telephone Firebase Auth code sent by SMS in a Dialogflow agent?
Like this: user receives the code by SMS and is prompted to call the Dialogflow agent that will ask for this code to finish the auth process.
Is it possible?
The final step of Firebase's phone number authentication to sign the user in with their verification code as shown here. As far as I can see this is only possible with the client-side SDKs of Firebase, which means that the sign-in must be completed on the device itself.
In DialogFlow you'd typically use the Firebase Admin SDK. While the Admin SDK supports related operations ("Create a new user with a phone number without having to go through the SMS verification flow" and "Change a user's phone number without having to go through the SMS verification flow"), it doesn't allow you to verify that the user has control of the phone number based on the code that was texted to them.
I have got the firebase.auth().signInWithPhoneNumber(number, appVerifier) to work nicely, but realized something that I didn't before. As soon as you put in the sms verification code it creates a whole other user under the phone auth, which makes since.
What I want to do however is just allow my current email/password users to add a phone number and then before they sign in have to go through a process of getting a verification sms code and put it in and only then through the success block log that user in.
My current solution is to add the phone number to the email/password account. Go through the phone auth process and if successful log out the phone auth account and then log the email/password account in with the same phone number. This sounds like a bad idea in the long run however, so is there a sms verification without authentication in firebase?
What you can do is to link your email/password user with a phone number credential using linkWithPhoneNumber method of User.
Check out the docs here: https://firebase.google.com/docs/auth/web/phone-auth
Linking to a phone number credential requires the user to verify their phone number with SMS code.
That case does sound like a bad idea.
Unfortunately, Firebase doesn't yet provide SMS verifications without Phone Auth. You'll have to look for a different way to do that.