0
votes

I'm a firebase project owner, My DataBase rule read and write set to true, But I can't able to read and write in the cloudFireStore storage.SHA1 and SHA256 key also added to the googleservices.json file, Permission Denied exception occurs.

Exception details:

W/Firestore(12435): (21.3.0) [Firestore]: Listen for Query(users/null/info) failed: Status{code=PERMISSION_DENIED, description=Missing or insufficient permissions., cause=null} I/System.out(12435): com.google.firebase.firestore.FirebaseFirestoreException: PERMISSION_DENIED: Missing or insufficient permissions.

Database rules code:

rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {

// This rule allows anyone on the internet to view, edit, and delete
// all data in your Firestore database. It is useful for getting
// started, but it is configured to expire after 30 days because it
// leaves your app open to attackers. At that time, all client
// requests to your Firestore database will be denied.
//
// Make sure to write security rules for your app before that time, or else
// your app will lose access to your Firestore database
match /{document=**} {
  allow read, write: if true;
}

Any help will be greatly helpful.

2
Firestore Security Rules has a dependency on the service account and IAM binding. If the firebaserules.system role is missing for the service account, your security rules will deny all requests.you can refer to this link to set IAM role for the service account. - Shawn Di Wu
thanks, issues resolved - Tester12
To better reuse the information which may help the GCP community. Please help to up vote the answer I added, Thanks! - Shawn Di Wu

2 Answers

2
votes

resolved using cloud console:

gcloud projects add-iam-policy-binding project name
--member=serviceAccount:service-project [email protected]
--role=roles/firebaserules.system

2
votes

Firestore Security Rules has a dependency on the service account and IAM binding. If the firebaserules.system role is missing for the service account, your security rules will deny all requests.you can refer to this link to set IAM role for the service account.