fluttergoogle-cloud-firestorefirebase-security

Firebase Firestore Permission denied: Missing or insufficient permissions


I am trying to change the current Firebase project of my app but when I try to create a new user (When creating a user with email and password it also creates a document in the firestore database) I get this error :

 Write at users/<user id> failed: Missing or insufficient permissions.

I saw that it was caused because of the rule I set for the firestore but my rule is on true : firestore rule

I tried looking for an answer but everybody always says that it is caused by the rule I have set


Solution

  • You will have to update the rules in the Firestore tab in Firebase

    Go to Firebase -> Firestore -> Rules

    Firestore rules

    Then edit the rules like this:

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

    Notice how I've allowed anyone to read and write: allow read, write;

    And voila! You'll be able to write data in your Firestore now