gpt4 book ai didi

firebase - 在 Firebase 规则中限制对 Cloud Functions 的写入权限

转载 作者:行者123 更新时间:2023-12-03 23:18:26 25 4
gpt4 key购买 nike

关闭。这个问题需要details or clarity .它目前不接受答案。












想改善这个问题吗?通过 editing this post 添加详细信息并澄清问题.

4年前关闭。




Improve this question




我可以获得 Firebase 函数(数据库触发器)的 ID 以与 Firebase 规则一起使用吗?我只需要允许 Firebase 函数写入数据库。

更新:

澄清一下,我正在使用触发器数据库 Firebase 函数,我只想允许该函数写入数据库,但允许用户读取。我试过这种方法 Allowing write access only to Cloud Functions for Firebase但得到一个错误 The default Firebase app already exists. .但是,此链接适用于 Cloud Functions 而不是 Firebase 函数,我找不到任何其他相关问题。

最佳答案

似乎对 Cloud Functions for Firebase 和 Google Cloud Functions 存在误解(错误消息是因为在 Firebase 的 Cloud Functions 中使用了 Google Cloud Functions 的代码),但无论如何,这个问题的答案是您可以使用 adminRef而是在将数据写入 Firebase 数据库的函数代码中使用 ref:
event.data.adminRef相反 event.data.ref
这将为您提供完整的读写访问权限,而不是最终用户访问权限(请注意,您还必须注意在规则中向所有人表示拒绝)。

更新 : 似乎 adminFef 被替换为 ref 到期 changes在 Firebase 上,请按照示例进行相应的替换。

关于firebase - 在 Firebase 规则中限制对 Cloud Functions 的写入权限,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43642900/

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