Dholu
Dholu

Reputation: 697

"Error: permission_denied at /place: Client doesn't have permission to access the desired data." in Cloud FireStore

enter image description hereI know most probably this is a "Rules" issue and have tried multiple ways around it with no success...following are my rules.

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

This is the React Component where I am calling the data:

componentDidMount(){
  console.log('mounted');

  let database = firebase.database();
  var ref = database.ref('place')
  console.log(ref)
  ref.on('value', gotData, errData);

  function gotData(data){
    console.log(data);

  }
  function errData(err){
    console.log('Error');
    console.log(err);
  }

Upvotes: 0

Views: 147

Answers (1)

Doug Stevenson
Doug Stevenson

Reputation: 317477

Your question is showing rules for Firestore, but the code is accessing Realtime Database. They are completely different database systems with different rules systems and APIs that have nothing in common. You will need to examine and update the rules for Realtime Database instead (or change your code to query Firestore).

I can tell your code is using RTDB because of the call to firebase.database(). You will want to use firebase.firestore() instead, if you are actually trying to query Firestore.

Upvotes: 1

Related Questions