skip to Main Content

Hi I am trying in src>index.js
`

import {initializeApp} from 'firebase/app'

`

I am learning from a video. When the man in the video wrote this code, he wrote that it is being calculated next to him in green, but it does not write to me. and I think that’s why when I try to pull data from firebase database I get the following error in the console

index.html:1 Uncaught (in promise) FirebaseError: Missing or insufficient permissions.

Can anyone know the solution?

2

Answers


  1. Your firebase firestore rules don’t allow reads or write for the collection that you are trying to query from.

    Goto Firebase console and modify the firestore rules
    Docs: https://firebase.google.com/docs/firestore/security/get-started

    Login or Signup to reply.
  2. Your security rules do not allow anyone to read or write to your database. If you set your rule to true as shown below, it should allow you to write:

    Sample:

    rules_version = '2';
    service cloud.firestore {
      match /databases/{database}/documents {
        match /series/{document} {
          allow read, write: if true;
        }
      }
    }
    

    To configure your Firestore Security Rules:

    Firebase Console > Firestore Database > Rules (Tab) > Edit Rules > Deploy & Test

    In this rule anyone can read or write to your series collection. I recommend reading about Firestore Security Rules to restrict access to authorized users only.

    Thanks.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search