Firebase数据库-使用REST请求发送有效负载 [英] Firebase Database - Sending payload with REST request

查看:50
本文介绍了Firebase数据库-使用REST请求发送有效负载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在执行对Firebase实时数据库的GET请求时是否可以包括有效负载/参数,以便访问Firebase实时数据库规则中的有效负载/参数?

Is is possible to include a payload/parameter when executing a GET request to Firebase Realtime Database, in order to access the payload/parameter in the Firebase Realtime Database rules?

使用带有Java脚本的React Native.

Using React Native with Javascript.

推荐答案

对于对实时数据库的GET/读取请求,安全规则中提供了以下信息:

For a GET/read request to the Realtime Database, the following information is available in your security rules:

  1. 请求的路径,或 查询 .
  2. auth 变量指示登录的用户,包括 auth.token .

因此,如果您想传递信息,则必须将其放入其中之一.例如,您可以将有效负载作为路径的一部分,也可以将其作为自定义声明.

So if you want to pass information, you will have to put it into one of these. For example, you can make the payload part of the path, or you can store it in the user's profile as a custom claim.

通常,对于临时信息(例如随机数或共享机密),首选放置路径,而对于某些半永久状态的用户(例如将其标记为应用程序管理员),自定义声明更为常见

Putting in the path is typically preferred for short-lived information, like a nonce or a shared secret, while a custom claim is more common for some semi-permanent state of the users, such as them being marked as an application administrator.

这篇关于Firebase数据库-使用REST请求发送有效负载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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