Reputation: 907
Problem:
Firestore not returning data and giving exception "PERMISSION_DENIED: Missing or insufficient permissions"
Rules:
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write: if true;
}
}
}
Android Code:
firestore.collection("todos").document("t2").get().addOnCompleteListener(new OnCompleteListener<DocumentSnapshot>() {
@Override
public void onComplete(@NonNull Task<DocumentSnapshot> task) {
Log.d(TAG, "E1:" + task.getException().getMessage());
}
});
Database:
Working:
Things I tried:
Please tell me what I might be missing. As firebase google authentication is working fine, I can say my app is communicating with firebase and SHA-1 is also right. I found other similar questions too, but all says to change rules, which already flexible as possible. I know my rules are insecure, I just want to communicate with database to make sure everything is right.
Upvotes: 1
Views: 234
Reputation: 907
Finally after wasting several hours, creating multiple projects and multiple apps, my problem got solved, and solution is very weird.
Google account on which I was creating these projects was relatively new and even though I was creating new projects I was getting same results. Then I created project using my old Google account which I used in past for firebase, and it started working fine.
I don't know why this happened. I don't think reason is related to bank verification because my project was just started and in free tier, and all other features were working fine. May be this was bug in firebase.
Upvotes: 1