我试图在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.
更多推荐
发布评论