[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.
at new FirestoreError (index.cjs.js:x)

How to fix the Missing or Insufficient Permissions Error

Option 1: Change rules (Recommended)

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

Change:

service cloud.firestore { match /databases/{database}/documents { match /{document=**} { allow read, write: if false; } } }
Code language: JavaScript (javascript)

to:

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

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]

Subscribe
Notify of
guest
1 Comment
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
Jitumani Bhagabati
Jitumani Bhagabati
2 months ago

Really not working. Even data also not fetching from database