I have an flutter app that talks to the same collection and everything works fine. However, I have another flutter app app which I have also added to Firebase and done all the configuration as in the first app but I keep getting the error as added below.
[Firestore]: Listen for Query(target=Query(consultations/6437f769a0016e1e8fe563b0/matters order by name);limitType=LIMIT_TO_FIRST) failed: Status{code=PERMISSION_DENIED, description=Missing or insufficient permissions., cause=null}Also, I have set my rules as follows
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write: if true;
}
}
}
I will really need someone to point me in the right direction. Thanks
2
Answers
Apparently, I needed to clean my project and rebuild. This is because, I changed the firebase' google-services.json file from a previous firebase account to the current one.
Posting this as a community wiki for everyone’s visibility. As mentioned by most200, the PERMISSION_DENIED error typically means that the request is blocked by Firestore rules. As seen in the answer to this post that was recognized by Google Cloud, google-services.json should always be updated each time a new application is added to your Firebase project. That’s because each application is identified through its own unique package name. That is why cleaning and rebuilding your project is necessary.