Chris
Chris

Reputation: 2314

Flutter Firebase caller does not have permission but rules are open

I am testing Firebase at the moment and simply trying to upload an image. For testing I have set up these rules:

Firestore:

rules_version = '2';
service cloud.firestore {
  match /databases/{database}/documents {
    allow read, write
  }
}

But Flutter is complaining:

[cloud_firestore/permission-denied] The caller does not have permission to execute the specified operation.

What am I missing here? I thought my rules mean that everyone can read/write in the database.

(Like I said this is just for testing purposes, so no Auth yet)

Upvotes: 0

Views: 189

Answers (2)

Chris
Chris

Reputation: 2314

I found a solution:

rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
  allow read, write: if true;
  }
 }
}

I guess the if true is crucial here... didn't know that

Upvotes: 2

Kushal Biyani
Kushal Biyani

Reputation: 1

May be this code can help you:

service cloud.firestore {
  match /databases/{database}/documents {
    match /{document=**} {
      allow read, write;
    }
  }
}

Upvotes: 0

Related Questions