【问题标题】:FireBase Auth SignOut : PlatformException(FirebaseException, User has already been linked to the given provider., null)FireBase Auth SignOut:PlatformException(FirebaseException,用户已经链接到给定的提供者。,null)
【发布时间】:2020-02-29 00:02:45
【问题描述】:

我正在为用户进行firebase身份验证。我同时使用谷歌和手机登录。用户已成功通过身份验证并像那样登录。

但是当我从应用程序中退出并尝试使用相同的谷歌和手机再次登录时,它会告诉我 -

短信验证码失败:PlatformException(FirebaseException, User 已经链接到给定的提供者。, null)

我已使用以下代码从应用程序中退出。

FlatButton(
              child: Text("Sign out", style: theme.textTheme.button),
              onPressed: () async {
                await GoogleSignIn().signOut();             
                await FirebaseAuth.instance.signOut();

              },
            )

【问题讨论】:

  • 但是如果有人卸载了应用程序并重新安装了怎么办。下面的答案不适用于它。请帮忙。

标签: firebase authentication flutter firebase-authentication


【解决方案1】:

嗯,这个问题可以通过从 firebase auth 控制台中删除 firebase 用户来解决。

希望我在 firestore 数据库中有与该帐户相关联的数据,当他尝试登录并通过搜索密钥(电话号码)检索他以前的数据时,我曾经使用该数据再次验证该用户。

final FirebaseUser firebaseUser;
final GoogleSignInAccount googleUser;
 onPressed: () async {
                await GoogleSignIn().signOut();
                googleUser.clearAuthCache();
                print('SignedOut');
                await firebaseUser.delete();
                await FirebaseAuth.instance.signOut();                
                print('signedOut from FireBase');                
              }

这个问题得到了解决,并且不会对与用户链接的数据造成任何损坏。

【讨论】:

    猜你喜欢
    • 2020-11-18
    • 1970-01-01
    • 2021-06-01
    • 2018-05-02
    • 1970-01-01
    • 1970-01-01
    • 2021-06-09
    • 2018-04-17
    • 2019-04-07
    相关资源
    最近更新 更多