5

I've been working on this for perhaps a day but I can't get it to work at all. I set up a database with no security rules:

enter image description here

Then I try to access it in my angular fire app:

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

But I still get the following permission errors:

Error: permission_denied at /test/test: Client doesn't have permission to access the desired data.

I also ran the simulator and got successful results:

enter image description here

I also set up my environment.ts file:

enter image description here

Am I doing something wrong?

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
AskYous
  • 4,332
  • 9
  • 46
  • 82
  • You get that when the node you're reading from isn't there. Is that the case? – Pedro Rodrigues Oct 21 '18 at 00:54
  • 4
    The security rules you're showing apply to Cloud Firestore, while the Your use of `object()` seems to indicate that you're using the Realtime Database. While both databases are part of Firebase, they're completely separate, and the security for one don't apply to the other. To fix the error, you will have to set the rules for the Realtime Database. For a walkthrough of how to do that, see https://stackoverflow.com/a/52129163 – Frank van Puffelen Oct 21 '18 at 01:31
  • Thank you! I was referencing the wrong database technology. – AskYous Oct 21 '18 at 20:09

1 Answers1

-2

This is an issue on firebase side. You need to update Real-time database rules:

"rules": {
    ".read": true,
    ".write": true
  }
Bhargav Rao
  • 50,140
  • 28
  • 121
  • 140
sid busa
  • 191
  • 1
  • 5