firebase / quickstart-android

Firebase Quickstart Samples for Android
https://firebase.google.com
Apache License 2.0
8.89k stars 7.33k forks source link

W/SyncTree: Listen at /message failed: DatabaseError: Permission denied #33

Closed yokei15 closed 8 years ago

yokei15 commented 8 years ago

06-02 12:42:49.892 750-750/com.android.firebase_database W/MainActivity: Failed to read value. com.google.firebase.database.DatabaseException: Firebase Database error: Permission denied at com.google.firebase.database.DatabaseError.toException(Unknown Source) at com.android.firebase_database.MainActivity$1.onCancelled(MainActivity.java:40) at com.google.android.gms.internal.zzafp.zza(Unknown Source) at com.google.android.gms.internal.zzagn.zzSu(Unknown Source) at com.google.android.gms.internal.zzags$1.run(Unknown Source) at android.os.Handler.handleCallback(Handler.java:739) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5930) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1405) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1200) 06-02 12:42:49.892 750-795/com.seehash.firebase_database W/RepoOperation: setValue at /message failed: DatabaseError: Permission denied

How to enable the permission in Firebase Database.. Can some one help me am facing this permission denied

samtstern commented 8 years ago

@yokei15 the default Firebase Database rules are to deny access to unauthenticated clients. You can see these rules if you go to the Database tab of the Firebase console and then click Rules.

You should use Firebase Authentication to log in on your client. The simplest way to do this is Anonymous Authentication.

geraldokandonga commented 8 years ago

@yokei15 i am also getting the same error i have put my database as follow

{
  "rules": {
     "users": {
      "$uid": {
        ".write": "$uid === auth.uid",
        ".read" : "$uid === auth.iud"
      }
    }
  }
}

and i am signing in successfull but when i make a post and than when i try to get the post displayed along with my username i am geting the error

any help guys

Thankx

samtstern commented 8 years ago

@gkfillipus this issue is closed, would you mind opening a new issue with more information about your exact issue?

dineshdinu1173 commented 6 years ago

Using the valid rule: service cloud.firestore { match /databases/{database}/documents { match /{document=**} { allow read, write: if true; } } } But getting some error like below: V/FA: Inactivity, disconnecting from the service W/RepoOperation: setValue at /message failed: DatabaseError: Permission denied

samtstern commented 6 years ago

@dineshdinu1173 this issue is about Realtime Database, not Cloud Firestore.

am9072 commented 5 years ago

When you are working with real time database integrate with firebase then you have to add the read and the write permissions by yourself.(This is hectic one)

You need to set the rules by yourself { "rules": { ".read": "true", ".write": "true" } }

like this or you can go through the video for more details https://youtu.be/b2SBkUWLKSc

Heet6271 commented 1 year ago

Listen at /product failed: DatabaseError: Permission denied what was the solution of this line