firebase - FireBase Auth SignOut:PlatformException(FirebaseException,用户已经链接到给定的提供者。,null)
问题描述
我正在为用户进行firebase身份验证。我同时使用谷歌和手机登录。用户已成功通过身份验证并像这样登录。
但是当我从应用程序中注销,并尝试使用相同的谷歌和手机再次登录时,它告诉我 -
短信验证码失败:PlatformException(FirebaseException, User has been linked to the given provider., null)
我已使用以下代码从应用程序中注销。
FlatButton(
child: Text("Sign out", style: theme.textTheme.button),
onPressed: () async {
await GoogleSignIn().signOut();
await FirebaseAuth.instance.signOut();
},
)
解决方案
好吧,这个问题是通过从 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');
}
这个问题得到了解决,而不会对与用户链接的数据造成任何损坏。
推荐阅读
- selenium - Selenium Google 登录在本地有效,但在 CircleCI 中无效
- c# - 项目的 Roslyn 文档返回 null
- python - 将固件迁移到 Django 测试数据库
- c# - 在 C# 中为每个项目分配另一个项目
- reactjs - 前端后端通信数据 - 最佳实践
- javascript - 在 Swiper 循环模式下最后一张幻灯片后不平滑过渡
- c - 完美正方形 - 有人可以解释以下数学吗?
- ios - 无法在 SwiftUI 中实现 Apple Pay
- javascript - Dhtmlx Gantt 在 XAMPP 工作但不是 VPS 服务器
- postgresql - 在 docker-entrypoint-initdb.d 中运行脚本后,docker-compose postgres 重新启动