FIREBASE WARNING:设置为/ users / simplelogin:32失败:permission_denied

时间:2015-04-30 02:27:11

标签: firebase angularfire

在我的应用程序之前,我成功创建了帐户,直到我提出了一些规则

{
  "rules": {
    "users": {
      "$uid": {
        // grants write access to the owner of this user 
       // account whose uid must exactly match the key ($uid)
        ".write": "auth !== null && auth.uid === $uid",
        // grants read access to any user who is logged in 
       // with an email and password
        ".read": "auth !== null && auth.provider === 'password'"
      }
    }
  }
}

然后,创建帐户是因为我在仪表板中看到了这些帐户。但是一旦我尝试创建,我就会遇到这种错误

FIREBASE WARNING: set at /users/simplelogin:32 failed: permission_denied 

1 个答案:

答案 0 :(得分:3)

由于您希望用户最初能够创建自己的节点,因此您需要明确允许位置为新的情况。

基于documentation on the auth parameter

".write": "!data.exists() || auth.uid === $uid""

注意:我不完全确定这会有效,但觉得它在答案格式中比在“试试这个”评论中更具可读性。