1

I am using firestore database. In that I have set security rules ture for all document read/write. But when i am using get, update and delete method from android it returns Missing or insufficient permissions error.

I have read in stackoverflow that collection should exists in database. I have tried that also but it didn't not work. https://stackoverflow.com/a/47270946/7591349

Security Rule:

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

Get call from the android side:

App.instance?.firestoreDB?.collection(DBConstant.COLLECTION_USER)
         ?.whereEqualTo(USER_PHONE_NUMBER, numberCode)
         ?.get()
         ?.addOnSuccessListener {}
         ?.addOnFailureListener { e -> }

Response from firestore:

Listen for Query(user where phoneNumber == +918888888885) failed: Status{code=PERMISSION_DENIED, description=Missing or insufficient permissions., cause=null}

Same code and same security rules worked in my other firebase project but I could not figure it out what is wrong with this project.

==== EDITED ===

Security Rules

Database Structure

Aanal Shah
  • 1,946
  • 2
  • 20
  • 30

0 Answers0