flutter - 如何删除使用自定义令牌创建的 FirebaseAuth currentUser
问题描述
如果他们使用标准提供商之一(例如谷歌)登录,我在删除当前用户时没有任何问题。
但是,当我使用await FirebaseAuth.instance.currentUser.delete()
自定义令牌登录的用户(在我的实例中,使用 Firebase Admin 在具有 LINE 令牌的云功能中创建)时,我没有收到任何错误,但用户也没有被删除当我检查控制台时 Firebase。
我的删除用户代码:
Future<void> deleteAccount() async {
try {
await FirebaseAuth.instance.currentUser.delete();
} on FirebaseAuthException catch (e, s) {
if (e.code == 'requires-recent-login') {
print(
'The user must reauthenticate before this operation can be executed.');
await signInWithLine();
await FirebaseAuth.instance.currentUser.delete();
} else {
print('Firebase auth delete account error:\n$e');
print('============stack=========\n$s');
}
} catch (e, s) {
print('Firebase auth delete account error:\n$e');
print('============stack=========\n$s');
}
}
FirebaseAuth.instance.signInWithCustomToken(customToken)
如果他们的身份验证记录是用而不是创建的,我是否错过了删除用户需要采取的额外步骤FirebaseAuth.instance.signInWithCredential(oauthCredential)
?
解决方案
推荐阅读
- python - 分配数据框的列值,其中两个数据框的列相等
- r - 如何正确形成ggplot图,而不切断图的重要部分?
- javascript - 重新加载时下拉选择重新加载到第一个选项
- mongodb - 在 MongoDB 中从周日到一周前传递数据
- c++ - 在 C++ 中每次运行时获得相同的随机双精度数
- python - 在 tensorflow 2.x 中替代 with_grads 以在 tensorboard 上记录梯度
- javascript - 如何在 laravel 中使用 ajax 更改数据库中的状态
- android-studio - 删除 .zsh_history 文件安全吗?
- javascript - “addEventListener”不适用于 Chrome 扩展
- python - 如何使用 pyodbc 发出包含 python 变量作为参数的 SQL 查询?