如何使用firebase函数在db中编写而不是admin(How to write in db with firebase function not as admin)

系统教程 行业动态 更新时间:2024-06-14 17:02:18
如何使用firebase函数在db中编写而不是admin(How to write in db with firebase function not as admin)

我试图在firebase函数上写一些数据到一些http触发器的数据库,我的问题我没有找到任何例子如何没有管理员权限可行,因为我仍然需要采取firebase规则...

I am trying to write on firebase function some data to DB when some http triggers ,my issue I didn't find any examples how is it possible to do without admin permission because I still want firebase rules to be taken...

最满意答案

您正在寻找event.data.ref 。 从参考文档 :

返回对发生触发写入的数据库位置的Reference 。 此Reference与执行写入的客户端具有相同的最终用户权限。 因此,如果未经身份验证的客户端执行了写操作,则此Reference未经身份验证。 如果执行写入的客户端被认证为某个Firebase Auth用户,则此Reference将作为同一用户进行身份验证。

You're looking for event.data.ref. From the reference documentation:

Returns a Reference to the Database location where the triggering write occurred. This Reference has the same end-user permissions as the client that did the write. So, if an unauthenticated client did the write, this Reference is unauthenticated. If the client that did the write is authenticated as a certain Firebase Auth user, this Reference is authenticated as that same user.

更多推荐

本文发布于:2023-04-21 18:47:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/dzcp/193e7e28a07131a49c69ac4a34d8c085.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何使用   函数   而不是   firebase   db

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!