首页 > 解决方案 > 错误:permission_denied at /categories:客户端无权访问所需数据

问题描述

我有一个招聘人员给我的任务,在这里我需要使用 react redux 和 firebase 建立一个电子商务网站。

前端部分已完成,但无法从 firebase 获取数据。这是我的规则选项卡内容我该如何修改它。

this.props.firebase.categories().on('value', snapshot => {
        // Not coming here.
            console.log(snapshot, snapshot.val)
        }, (error) => {
        // Error shows here
            console.log(error);
        });


// Content of Rules tab
service cloud.firestore {
  match /databases/{database}/documents {
    match /{document=**} {
      allow read, write: if true;
    }
  }
}

遵循本教程: https ://www.robinwieruch.de/complete-firebase-authentication-react-tutorial/#react-application-setup

标签: reactjsfirebasefirebase-realtime-database

解决方案


在规则(firebase)中将读取和写入权限设置为 true。


推荐阅读