Firebase auth onUpdate 云功能,用于当用户更新他们的电子邮件时

Posted

技术标签:

【中文标题】Firebase auth onUpdate 云功能,用于当用户更新他们的电子邮件时【英文标题】:Firebase auth onUpdate cloud function for when a user updates their email 【发布时间】:2018-06-04 15:42:06 【问题描述】:

每当我的用户更新他们的电子邮件地址时,我都需要运行 Firebase 函数,除了 auth 只有 onCreate 和 onDelete。我如何对电子邮件更新做出反应?

【问题讨论】:

【参考方案1】:

目前无法直接响应在 Firebase 身份验证中更改的电子邮件地址。如果您希望将其视为一项功能,请提交feature request。

您可以通过让您的应用侦听身份验证事件 (android),将User object 传递给您的侦听器,并将用户的电子邮件地址写入 RealtimeDatabase 位置,从而对它间接做出反应(或 Firestore 文档)用于该用户的 UID。然后,您可以使用database trigger 来跟踪您的用户在数据库中的位置,并对那里的更改做出反应。

【讨论】:

想知道现在是 2020 年是否有任何更新 @tazmaniax 看起来 onCreate 和 onDelete 是仅有的两个公共函数:firebase.google.com/docs/reference/functions/… 太令人沮丧了,拥有一个 onUpdate 函数打开了很多选项。 这还没有实现,非常令人沮丧。大约一年前我提交了一个功能请求,当时收到了以下回复:Upon checking on our end, there's an internal feature request filed to have an onUpdate() method for Authentication. However, I cannot guarantee as to when this feature will be officially rolled out. 感觉这个功能应该是不费吹灰之力... 我还提交了一个 onUpdate 功能的功能请求并收到了这个:There is no timeline I can share on when this feature will come out, but for now, you can keep an eye out for updates on ourofficial blogandrelease notes.希望这将很快实现!

以上是关于Firebase auth onUpdate 云功能,用于当用户更新他们的电子邮件时的主要内容,如果未能解决你的问题,请参考以下文章