Firebase Realtime数据库安全规则模拟器上的访问被拒绝

问题描述 投票:1回答:1

我很难理解为什么模拟器使我无法进行此输入

我提供了此身份验证令牌正文:

{
  "account": "7xms2zm6noz03f2mvn",
  "playerId": "d3221a31-263c-4629-92fb-6cac89b67088"
}

我正在使用自定义身份验证来提供上述blob。

请参阅附件的屏幕快照,以了解模拟器如何处理此问题:

enter image description here

firebase response

这是我的数据库树:

enter image description here

我想念什么?

firebase firebase-realtime-database firebase-security-rules
1个回答
0
投票

[看来,当您使用模拟器时,“身份验证令牌有效负载”实际上处于auth级别,而不是auth.token级别。

因此,您需要像这样模拟auth.token.account

{
  "token": {
    "account": "7xms2zm6noz03f2mvn",
    "playerId": "d3221a31-263c-4629-92fb-6cac89b67088"
  }
}

[您可以说出它的名字(显然)是错误的,因为例如,如果您选择了“ Google”提供程序,则provideruid都位于该Blob的顶层(无法修改) ,即where you would expect to find them

this image中的this blog post类似,将token块显示为模拟器中的子块。

© www.soinside.com 2019 - 2024. All rights reserved.