gpt4 book ai didi

Firebase Auth - 更新用户的电子邮件后,Firebase Auth 注销用户

转载 作者:行者123 更新时间:2023-12-02 13:12:55 27 4
gpt4 key购买 nike

我在我的应用中使用 Firebase Auth。我更新电子邮件如下:

firebaseAuth.currentUser?.updateEmail(email)

电子邮件正在 100% 更新(必要时我也会重新授权)。我的问题是在更改电子邮件后,用户正在注销他的帐户并必须重新登录。

当我打电话

val user = firebaseAuth.currentUser 

更新电子邮件后,用户为空,我的应用程序希望您使用新电子邮件地址再次登录。

这是正确的行为吗?更改帐户电子邮件后必须重新登录,这会带来非常糟糕的用户体验。

最佳答案

我认为 Firebase 出于安全原因是故意这样做的。您可以通过在更改用户的电子邮件后自动调用 Firebase 的登录函数来解决此问题。

但是,如果您使用的是最新版本的 Firebase,我认为这不是正常行为。他们在文档中明确声明您需要重新验证用户才能执行任何配置文件更改(如果他最近没有登录)。

Some security-sensitive actions—such as deleting an account, setting a primary email address, and changing a password—require that the user has recently signed in. If you perform one of these actions, and the user signed in too long ago, the action fails with the FIRAuthErrorCodeCredentialTooOld error.

在我这边,这种效果只发生在用户登录的其他设备上,而不发生在执行编辑操作的设备上。

关于Firebase Auth - 更新用户的电子邮件后,Firebase Auth 注销用户,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55283978/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com