Firebase身份验证将电子邮件与电话连接 [英] Firebase Authentication connect Email with Phone

查看:87
本文介绍了Firebase身份验证将电子邮件与电话连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我当前正在通过Firebase使用电子邮件电话号码身份验证.

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

我有 3 个EditText用于:

And i have 3 EditText for:

  • 电子邮件
  • 电话号码
  • 密码

但是问题在于,用户完成注册后,显然会创建 2 个帐户实例,一个实例用于电子邮件,第二个实例用于电话号码.

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?

推荐答案

取决于您是要允许使用电子邮件还是电话号码登录,还是要允许将电话号码用作第二个电话号码因素,对于登录,有不同的解决方案.

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.

如果您只是想让电话号码是第二种登录方式,则可以使用Firebase用户上的linkWithCredential方法链接凭据.这样,您可以根据需要添加任意多种登录方式. Firebase对此有良好指南.

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.

如果要将电话号码设为be a second factor of authentication,则需要有一个自定义身份验证提供程序,该提供程序将进行第二因素身份验证.与此相关的还有入门指南,但是2要素认证部分本身将取决于您.

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.

这篇关于Firebase身份验证将电子邮件与电话连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆