i have set my firebase cloud database rule to default
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write: if false;
}
}
}
but while my flutter app tries to interact with it, this error occurs
Error performing get, PERMISSION_DENIED: Missing or insufficient permissions., null
This condition:
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write: if false;
}
}
}
means you are disallowing both read and write from and to firestore, you can change the rules to the following:
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read : if true;
allow write: if false;
}
}
}
Which will allow you to read but not write to the database, or you can use the following:
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write: if request.time < timestamp.date(2020, 9, 20);
}
}
}
Use the above rules just for testing, check here:
https://firebase.google.com/docs/firestore/security/rules-structure
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.