1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Firebase tips(Database rule .1)

Last updated at Posted at 2017-09-21

FIREBASE TIPS

1. Allow users to read everything and write everything.

database.rule.json
{
  "rules": {
    ".read": true,
    ".write": true
  }
}

2. Allow users to read everything and write everything under user object.

database.rule.json
{
  "rules": {
      "user" :{
        ".read": true,
        ".write": true
      }
  }
}

3. Allow users who is certificated to read everything and write under own($uid) object.

database.rule.json
{
  "rules": {
      "user" :{
        "$uid": {
            ".write": "$uid === auth.uid",
            ".read": "auth != null"
        }
      }
  }
}
  • TEST:Read without certification.
    test1.png

  • TEST:Read with certification.
    test2.png

  • TEST:Write with other certification.
    test3.png

  • TEST:Write with certification.
    test4.png

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?