I am currently using Email and Phone number authentication using Firebase.
And i have 3 EditText for:
But the problem is when the user is done registering it obviously creates 2 instance of accounts, one for the Email and second for the Phone number.
I would like to link the Email and Phone number together as one account. Is there any way to do that?
If you haven't yet connected your app to your Firebase project, do so from the Firebase console. Enable Email/Password sign-in: In the Firebase console, open the Auth section. On the Sign in method tab, enable the Email/password sign-in method and click Save.
Create fictional phone numbers and verification codesIn the Firebase console, open the Authentication section. In the Sign in method tab, enable the Phone provider if you haven't already. Open the Phone numbers for testing accordion menu. Provide the phone number you want to test, for example: +1 650-555-3434.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With