繁体   English   中英

添加电子邮件/密码提供商,即使有另一个提供商使用 email

[英]add Email/Password provider even there's another provider using the email

我的应用程序具有以下登录方法:

  • 第 3 方提供商(Facebook、Google、Apple)
  • 电子邮件/密码

该应用程序有一项功能,用户可以切换到传统登录,但他们需要为该帐户提供密码才能继续。 每当我从FirebaseAuth调用createUserWithEmailAndPassword为已经存在但使用不同提供程序(如 Facebook 等)的用户创建Email/Password身份验证提供程序时,总是会出现此错误。

[firebase_auth/email-already-in-use] The email address is already in use by another account.

我该如何解决这个错误? 我应该更改身份验证流程中的某些内容吗?

当您调用createUserWithEmailAndPassword时,您正在做的是尝试创建一个已经存在的帐户。 在 FireBase 中,可能会有一个没有密码的用户,这就是您遇到的情况。

相反,我相信你需要使用User.updatePassword()https://pub.dev/documentation/firebase_auth/latest/firebase_auth/User/updatePassword.html

然后您可以使用FirebaseAuth.instance.signInWithEmailAndPassword()登录。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM