Firebase用户在登录时合并身份验证提供程序

时间:2016-12-01 23:10:35

标签: angular firebase firebase-authentication firebase-security

在我的Angular 2应用中,我希望允许用户通过电子邮件/密码,Google和Facebook提供商进行连接。

首次登录时,我了解在firebase数据库中创建了一个用户条目。例如facebook:UUID。如果用户使用其他提供商登录,我了解firebase将阻止此操作,特别是如果电子邮件已被使用并且已在规则中设置为唯一。

所以我的问题是:我们如何自动,对用户透明,如果我们检测到电子邮件是相同的,则合并数据

在诸如udemy或其他大公司这样的优秀网站上,我们可以使用多种方法进行授权。我尝试使用Facebook和Google登录(两者都使用相同的电子邮件),他们会自动将我重定向到我的独特个人资料,而无需我方做任何操作以确认我想将我的帐户与其他提供商关联。

如何在Firebase中实现这一目标? 我们是否必须复制数据并制作我们自己的“用户数据收集”?

1 个答案:

答案 0 :(得分:2)

No entries are automatically created in the Firebase Database when a user signs in to Firebase Authentication. If your app creates such entries, you have code that does it for you. That's quite common, but not automatic.

If you're looking to allow the users to sign in to the same account with any supported provider, you're looking for account linking. It is documented here: https://firebase.google.com/docs/auth/web/account-linking