0
votes

The problem I'm facing is that even though I have Auth users and my rules I think are right, the simulator keeps denying.

Here is my Firebase Rules:

   {
  "rules": {
    "jobs": {
       "$uid": {
         ".read": "$uid === auth.uid",
         ".write": "$uid === auth.uid"
       }
     }
   }
}

And my firebase Database

"jobs" : {
    "5HSJNaWoBFbU8nPSy3zND0gH6n92" : {
      "collected" : "no",
      "collection date" : "10/03/19",
      "consignee" : "Annie Mattey",
      "delivered" : "no",
      "email" : "a_________________",
      "freight" : "2 Pallets",
      "pod" : "pick up at 9am",
      "reference" : "RE0003",
      "shipper" : "Thames Link"
    },
    "7pyXtGOULNNQSpsfaVeCjYynn6D3" : {
      "collect" : "no",
      "collection date" : "10/03/19",
      "cosignee" : "Molly Warner",
      "delivered" : "no",
      "delivery date" : "15/03/19",
      "email" : "mo______________",
      "freight" : "9 Pallets",
      "pod" : "Pick up at 9.30am at B____",
      "reference" : "RE0001",
      "shipper" : "Transport"
    },
     "vzWxCUeGAcNesru9iqyYTb9YQ0D3" : {
      "collected" : "no",
      "collection date" : "05/03/19",
      "consignee" : "test1",
      "delivered" : "no",
      "delivery date" : "10/03/19",
      "email" : "[email protected]",
      "freight" : "3 pallets",
      "pod" : "pick up at 9am on friday",
      "reference" : "RE0004",
      "shipper" : "testshipper"
    }
  }

However when using the simulator in firebase console I keep getting this when I use a Auth UID:

Type    read
Location    /
Data    null
Auth    { "provider": "anonymous", "uid": "5HSJNaWoBFbU8nPSy3zND0gH6n92" }
Admin   false

Is my rules wrong? Im not sure why it keeps denying.

2

2 Answers

0
votes

It seems that you are running the simulator to read from root / not the job/uid location for that $uid

0
votes

You are not using the Simulator properly, inside location you need to type a specific location you are trying to test in your case "jobs/sampleJobId/" then try it out with Authenticated and without, that should work.