处理已在使用的电子邮件地址 - Firebase身份验证 [英] Dealing with Email address already in use - Firebase Authentication

查看:261
本文介绍了处理已在使用的电子邮件地址 - Firebase身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序通过Firebase集成了Gmail和Facebook身份验证。我注意到,如果有人注册他们的Gmail,然后注册Facebook,如果Facebook有相同的电子邮件作为他们的Gmail,那么他们会得到的错误:

lockquote

电子邮件地址已被另一个帐户使用。


是处理此问题的唯一合理方法告诉用户使用不同的凭据登录?也许显示一条消息,如已经在使用的电子邮件,请注册不同的帐户?

解决方案

有3种方式您可以处理这个问题。

第一个是验证电子邮件地址是否存在,并显示一条消息。这正是你所说的。消息取决于您。

第二种方法是让用户每个电子邮件地址拥有多个帐户。换句话说,如果用户使用gmail注册,然后用Facebook注册并且他有相同的电子邮件地址,那么他最终会拥有2个不同的帐户。一个电子邮件地址,2个不同的帐户这不是一个好的做法,但根据您的需要,您甚至可以使用它。



第三种方法是只有一个帐户每个电子邮件地址这意味着您正在阻止用户使用与不同身份验证提供程序相同的电子邮件地址创建多个帐户。这是一种常见做法,也是Firebase控制台中的默认规则。这意味着,您将需要与另一个提供者实现后续的另一种身份验证,它将遵循相同的规则。在这种情况下,将只有一个帐户的电子邮件地址。



要启用或禁用此选项,请转到您的Firebase控制台,选择身份验证,选择登录方法选项卡,在页面底部,您会发现高级 section。



希望有帮助。


My app has gmail and facebook authentication integrated through Firebase. I noticed if someone signs up with their gmail then signs up with Facebook, if the Facebook had the same email as their gmail then they'll get the error:

"The email address is already in use by another account."

Is the only reasonable way to handle this to tell the user to sign in with different credentials? Maybe show a message like "Email already in use, please sign up with different account"?

解决方案

There are 3 ways in which you can handle this problem.

The first one is to verify if the email address exists and than display a message. This is exactly what you said. The message is up to you.

The second approach is to enable users to have multiple accounts per email address. With other words, if a user signs up with gmail and then signs up with Facebook and he has the same email address, than he ends up having 2 different accounts. A single email address, 2 different accounts This is not a good practice but according to your needs, you can even use it.

The third approach is to have only one account per email address. This means that you are preventing the users from creating multiple accounts using the same email address with different authentication providers. This a common practice and also the default rule in the Firebase console. This means, that you'll want to implement later another kind of authentication with another provider, it will follow the same rule. In this case, will have a single email address with a single account.

To enable or disable this option, go to your Firebase console, choose Authentication, select the SIGN-IN METHOD tab and at the bottom of your page you'll find the Advanced section.

Hope it helps.

这篇关于处理已在使用的电子邮件地址 - Firebase身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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