Ali Ghassan
Ali Ghassan

Reputation: 1180

why l cant have permission to access to firebase

I've some apps working with Firebase using database, but the problem is why l dont have permission to access the desired data to firebase database ?

enter image description here

   {
      "rules": {
        "profile": {
          "$uid": {
            ".read": "true",
            ".write": "$uid === auth.uid"

          }
        }
      }
    }

enter image description here main code

ionViewWillLoad(){
    this.fire.authState.subscribe(data => {
      if(data && data.email && data.uid){

        this.toastCtrl.create({
          message : ` welcome ${data.email}`,
          duration:2000
        }).present()

        this.itemRef  = this.db.object(`report/profile/${data.uid}`);
            this.item = this.itemRef.valueChanges();


      }

    })

  }

Upvotes: 0

Views: 67

Answers (1)

Doug Stevenson
Doug Stevenson

Reputation: 317750

Because, as I see in your screenshot, you're trying to access /. But you've only granted access to /profile/$uid. If you don't grant access to it, it's not readable from mobile clients. Or perhaps you meant to use a more specific path in the emulator to test?

Upvotes: 1

Related Questions