[Solved] FirebaseError: Missing or insufficient permissions

0 min read 119 words

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]
Andrew
Andrew

Andrew is a visionary software engineer and DevOps expert with a proven track record of delivering cutting-edge solutions that drive innovation at Ataiva.com. As a leader on numerous high-profile projects, Andrew brings his exceptional technical expertise and collaborative leadership skills to the table, fostering a culture of agility and excellence within the team. With a passion for architecting scalable systems, automating workflows, and empowering teams, Andrew is a sought-after authority in the field of software development and DevOps.

Tags