【发布时间】:2019-10-08 17:54:04
【问题描述】:
我是 Firebase 的新手。我对 Firebase 安全规则有疑问。我可以将数据写入 firebase 数据库,但无法读取写入的数据。 我的数据库看起来像-
user|
|_uid(auto-generated)
|
|_name:Bob
|_score:100
|_email:bob@gmail.com
我的 firebase 数据库规则如下所示-
"user":{
"$uid":{
"uname":{
".read":"$uid=== auth.uid",
".write":"$uid=== auth.uid"
},
"score":{
".read":"$uid=== auth.uid",
".write":false
},
"email":{
".read":"$uid=== auth.uid",
".write":"$uid=== auth.uid"
}
}}
我已经用模拟器进行了测试,一切(读写)都很好。但是尽管我登录了一个帐户,但无法从我的应用程序中读取。 当我将所有读写设置为真正的上 $uid 节点时,我的应用程序中的所有读写也都可以。但我想只允许授权人阅读
我已经在stackoverflow上搜索过了,但是没有解决办法。
对不起我的英语写作能力。
【问题讨论】:
-
“但无法从我的应用程序中读取”请编辑您的问题以包含 minimal complete/standalone code that anyone can run to reproduce this problem(请阅读链接,因为它非常有用)。