[英]Flutter: Link Facebook account with existing user
Cases:案例:
Sign in with facebook (working)使用facebook(工作)登录
Sign in with google with same credetials, firebase overrides login provider (working)使用相同的凭证登录谷歌,firebase 覆盖登录提供商(工作)
Now again sign in with facebook, firebase doesn't let me sign in and throws the exception:现在再次使用 facebook 登录,firebase 不让我登录并抛出异常:
[firebase_auth/account-exists-with-different-credential] An account already exists with the same email address but different sign-in credentials.
[firebase_auth/account-exists-with-different-credential] 已存在具有相同 email 地址但登录凭据不同的帐户。 Sign in using a provider associated with this email address.
使用与此 email 地址关联的提供商登录。
I'm working with Flutter. As it can be fixed with signInWithPopUp
or SignInWithRedirect
, but these functions don't work with Flutter (only available for web).我正在使用 Flutter。因为它可以通过
signInWithPopUp
或SignInWithRedirect
,但这些功能不适用于 Flutter(仅适用于网络)。
Is there any workaround to get it done?有没有解决方法来完成它?
If you want to be able to sign in with both providers, then in step 2 you need to link the second provider to the existing account rather than replace the Facebook account.如果您希望能够使用这两个提供商登录,那么在第 2 步中,您需要 将第二个提供商链接到现有帐户,而不是替换 Facebook 帐户。 To detect that you need to do that, you can call the
fetchSignInMethodsForEmail
method to find whether there's an existing account for the user's email address.要检测您是否需要这样做,您可以调用
fetchSignInMethodsForEmail
方法来查找用户的 email 地址是否存在现有帐户。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.