Error occurs when receiving flutter firestore data #1259
-
Using flutter + rowy, I created a collection called product and put data into it. Then, I tried to get the entire product data, but the following error occurred. FirebaseException ([cloud_firestore/permission-denied] The caller does not have permission to execute the specified operation.) I googled it and found out that it is caused by firestore rules. In rowy product Access controls, --- -----------------------FireStore role, below ------------------------------
} It's very frustrating. It is mentioned not to touch it directly in the Firestore rules, but the setting in rowy for the case where user is null is not visible anywhere. Please help me |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
make sure you have edited your rules for Both the storage and cloud_firestore(firestore database) to be able to read and write . |
Beta Was this translation helpful? Give feedback.
-
Hey @CodeKinggggggg, the error message you're encountering indicates a permission issue with Firestore. In your Rowy configuration, you have defined access controls for the "product" collection, but it seems that the rules are not allowing read access to non-logged-in users. To address this issue, you can modify your Firestore rules to allow read access to the "product" collection even when the user is not logged in. Here's an updated version of your Firestore rules with the necessary changes: rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
// Allow read access to the "product" collection for non-logged-in users
match /product/{document=**} {
allow read: if true;
allow create, update, delete: if colRule(["product"], ["ADMIN","EDITOR","VIEWER","OWNER"]);
}
// Rest of the existing rules...
}
} |
Beta Was this translation helpful? Give feedback.
Hey @CodeKinggggggg, the error message you're encountering indicates a permission issue with Firestore. In your Rowy configuration, you have defined access controls for the "product" collection, but it seems that the rules are not allowing read access to non-logged-in users.
To address this issue, you can modify your Firestore rules to allow read access to the "product" collection even when the user is not logged in. Here's an updated version of your Firestore rules with the necessary changes: