[Solved] FirebaseError: Missing or Insufficient Permissions

Using Firebase and get the following error in the console?

Uncaught Error in onSnapshot: FirebaseError: Missing or insufficient permissions.<br>at new FirestoreError (index.cjs.js:x)

How to fix the Missing or Insufficient Permissions Error

  1. Login to Firebase
  2. Go to Database -> Rules

Change:

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

to:

service cloud.firestore {
  match /databases/{database}/documents {
    match /{document=**} {
      allow read, write: if request.auth != null;
    }
  }
}

Option 2: Override Authorization / Disable Security

  1. Login to Firebase
  2. Go to Database -> Rules
  3. Change allow read, write from false to true [for dev]
  4. Change allow read, write from false to request.auth != null [for prod]