Firebase database rules for particular user

前端 未结 1 1442
攒了一身酷
攒了一身酷 2021-01-26 10:58

I have a db where I need read access to all users and write access when invoked in an apps script running by the user = \'firebaseowner@gmail.com\'

My firebase structu

相关标签:
1条回答
  • 2021-01-26 11:44

    You should check the auth variable.

    To define the security rules that allow write access to all the locations by this email address firebaseowner@gmail.com only:

    {
      "rules": {
        ".read": true,
        ".write": "auth != null && auth.token.email == 'firebaseowner@gmail.com'"
      }
    }
    

    To define the security rules that allow write access to only the location /users by this email address firebaseowner@gmail.com only:

    {
      "rules": {
        ".read": true,
        "users": {
          ".write": "auth != null && auth.token.email == 'firebaseowner@gmail.com'"
        }
      }
    }
    
    0 讨论(0)
提交回复
热议问题