Firebase Authentication connect Email with Phone

烈酒焚心 提交于 2019-12-18 04:42:22

问题


I am currently using Email and Phone number authentication using Firebase.

And i have 3 EditText for:

  • Email
  • Phone Number
  • Password

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?


回答1:


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.



来源:https://stackoverflow.com/questions/44677846/firebase-authentication-connect-email-with-phone

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!