Charlie Mcvicker
Charlie Mcvicker

Reputation: 41

Firestore read simulation fails, no highlighted line

So, I typically don't have problems writing firestore rules but I'm coming up short on why this simulation fails.

Simulator screenshot

If you don't want to follow the image link:

Rules:

service cloud.firestore {
  match /databases/{database} {
    match /server_credentials/{document = **} {
      allow read, write: if false;
    }
    match /users/{user_uid} {
        allow read, write;
        match /signatures/{sig_id} {
          allow read: if request.auth.uid != null  && resource.data.access == "public";
          allow read, write: if request.auth.uid == user_uid;
        }
        match /identity/{credential} {
          allow read, write: if request.auth.uid == user_uid;
        }
    }
    match /signatures/{sig_id} {
        allow read, list;
        allow write: if false;
    }
  }
}

Auth details: Google as provider and foo as the uid.

I'm testing a simple read to users/foo

Any help would be quite nice.

Upvotes: 2

Views: 262

Answers (1)

Doug Stevenson
Doug Stevenson

Reputation: 317750

This line is incorrect:

match /databases/{database} {

It should be this:

match /databases/{database}/documents {

This mistake is causing none of your rules to apply at all, and all access is being rejected by default.

Upvotes: 1

Related Questions