Search code examples
fluttergoogle-cloud-firestorefirebase-security

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)


Solution

  • 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