如何使用firebase功能以非管理员身份在数据库中写入 [英] How to write in db with firebase function not as admin

查看:57
本文介绍了如何使用firebase功能以非管理员身份在数据库中写入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在某些http触发器时在Firebase函数上向DB写一些数据,我的问题我没有找到任何示例,没有管理员权限怎么办,因为我仍然希望采用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被认证为该用户.

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.

这篇关于如何使用firebase功能以非管理员身份在数据库中写入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆