1
votes

Rule:

{
  "rules": {
    "userdata":{
        "$id":{

         ".read": "(auth.uid=='aI2OGxb2pnY58ix5ugZLv0rhZqn2')",
         ".write": "(auth.uid=='aI2OGxb2pnY58ix5ugZLv0rhZqn2')"


    }
    }
  }
}

Actually my rule is so different. But to confirm that auth.uid is not working for me. I added this into my rules and I got same result (Permission Denied).

And my original uid is also same as given in the above rules.

So are there anything wrong in the rule structure or I'm doing anything wrong in firebase configuaration.

Thanx

1
Are you trying to read/write at /userData or /userData/$id when you get permission denied? - Jacob Phillips

1 Answers

2
votes

Don't forget to set read and write rules to false.

{
  "rules": {
    ".read": "auth != false",
    ".write": "auth != false",
    "userdata":{
      "$id":{
       ".read": "auth.uid == $id",
       ".write": "auth.uid == $id",
      }
    }
  }
}

Hope it helps.