Permission_denied to access firebase datastore

瘦欲@ 提交于 2019-12-02 17:53:17

问题


I am trying to get access to my firebase data to run a little test. I have setup an app in the firebase console and set the access rules to:

// Allow read/write access to all users under any conditions 
// Warning: **NEVER** use this rule set in production; it allows
// anyone to overwrite your entire database.
service cloud.firestore {
  match /databases/{database}/documents {
    match /{document=**} {
      allow read, write: if true;
    }
  }
}

Nevertheless I am always getting the following error:

angular.js:14328 Error: permission_denied at /messages: Client doesn't have permission to access the desired data.

at this line of code:

var ref = firebase.database().ref().child('messages');

What I am I missing?


回答1:


Those rules are for firestore and not firebase-realtime database.

In the console go to the database section and click on the dropdown then choose RealTime database:

For the realtime database change your rules to this:

 {
 "rules": {
   ".read": true,
   ".write": true
  }
}

and then perform the tests.



来源:https://stackoverflow.com/questions/52092843/permission-denied-to-access-firebase-datastore

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!