错误:客户端无权访问所需数据

时间:2018-10-21 00:45:53

标签: firebase google-cloud-firestore angularfire2 firebase-security

我已经为此工作了一天,但我根本无法使它工作。我建立了没有安全规则的数据库:

enter image description here

然后我尝试在我的角度射击应用中访问它:

this.afDatabase
    .object("/test/test")
    .snapshotChanges()
    .subscribe(x => {
        console.log(x);
    });

但是我仍然遇到以下权限错误:

  

错误:/ test / test的权限被拒绝:客户端没有访问所需数据的权限。

我还运行了模拟器并获得了成功的结果:

enter image description here

我还设置了我的environment.ts文件:

enter image description here

我做错什么了吗?

1 个答案:

答案 0 :(得分:-1)

这是Firebase方面的问题。您需要更新实时数据库规则:

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