【问题标题】:Firebase Auth transactions with flutter颤动的 Firebase 身份验证事务
【发布时间】:2019-12-13 07:32:22
【问题描述】:

如何用flutter在这段代码中进行交易。

  FirebaseUser user = await FirebaseAuth.instance.currentUser();
  UserUpdateInfo userUpdateInfo = new UserUpdateInfo();
  userUpdateInfo.displayName=firstName+" "+lastName;
  await user.updateProfile(userUpdateInfo);
  await user.updateEmail(email);

【问题讨论】:

  • 我认为你不能。此外,您可能需要在调用 update* 之前调用 reauthenticate。方法(查看官方文档中的警告:firebase.google.com/docs/reference/android/com/google/firebase/…
  • @RicardoMarkiewicz 我的意思是我想用事务执行这个。如果请求更新配置文件或电子邮件中有任何错误,我会回滚 user.updateProfile(userUpdateInfo); user.updateEmail(电子邮件);
  • 我明白这个问题,但据我所知,你不能做你想做的事。
  • 我找不到解决这个问题的好方法。但我让它连续。一个一个更新

标签: android flutter dart transactions firebase-authentication


【解决方案1】:

您不能在 Authentification 中执行此操作,Transaction 和 batch 使用 firestore no with Authentification ,如果您连续更新会导致错误“这是一个安全敏感操作,需要用户最近登录。如果这个要求不满足,请用户再次认证,稍后再调用”。你应该一个一个更新。

【讨论】:

    猜你喜欢
    • 2020-10-23
    • 2019-02-16
    • 2020-06-18
    • 1970-01-01
    • 1970-01-01
    • 2021-05-25
    • 1970-01-01
    • 1970-01-01
    • 2020-05-18
    相关资源
    最近更新 更多