Firestore Permission Denied in Flutter? 7 Causes and Fixes (2026)
Why does Firestore say permission denied in my Flutter app?
Because your Security Rules rejected the request, not because the Flutter plugin is broken. In Flutter the error usually arrives as [cloud_firestore/permission-denied], and the native logs show PERMISSION_DENIED: Missing or insufficient permissions. Firebase's rules guide says every request from a mobile or web client is checked against your rules, and "if the rules deny access to any of the specified document paths, the entire request fails". So the fix is finding which rule said no, and why. This guide covers the seven causes we check, in order, against the Cloud Firestore Security Rules documentation (last updated 2026-11-12), checked on 2026-11-15.
GSPTeck is giosaia's indie studio building mobile and web apps with Flutter and Firebase. Every one of these causes is a rules or setup problem you can confirm in a few minutes with the Rules Playground or the emulator, before you change any Dart code.
The 7 causes at a glance
Start with the cause whose symptom matches yours; most of them can be ruled in or out without a new build.
| # | Cause | Typical symptom | Fix |
|---|---|---|---|
| 1 | Database created in production (locked) mode | Every read and write fails | Write rules for each collection you use |
| 2 | User isn't signed in yet | Fails on cold start, works later | Wait for authStateChanges() before querying |
| 3 | Query asks for more than the rules allow | Single document works, list query fails | Add the same where filter the rule checks |
| 4 | Rule doesn't cover a subcollection | Parent works, child path fails | Add a match for the subcollection |
| 5 | Write fails a data condition | Reads work, one write fails | Check request.resource.data fields |
| 6 | App Check enforcement | Fails in debug builds or emulators only | Register a debug token |
| 7 | Rules not deployed, or deployed elsewhere | Console rules look right, app still fails | Deploy to the right project and database |
1. Is the database in production mode with no rules for your data?
Probably, if every request fails. Firebase's quickstart says production mode "denies all reads and writes from mobile and web clients", while your server code using an Admin SDK still works. That's why a Cloud Function can read a collection your app can't.
The fix is not allow read, write: if true. Firebase's insecure-rules guide warns that open rules let "anyone who guesses your project ID" read, change or delete your data. Write a rule per collection instead, for example letting a user read and write only their own document:
match /users/{userId} {
allow read, write: if request.auth != null && request.auth.uid == userId;
}
Also look for a request.time < timestamp.date(...) condition. If your rules contain one, every client request fails once that date has passed, which looks exactly like a sudden permission error in an app that worked last month.
2. Is the user actually signed in when the query runs?
Often not, on the first frame. If your rule checks request.auth != null, any query that fires before Firebase Auth has restored the session is evaluated as unauthenticated and rejected. The typical sign is a permission error on cold start that disappears after a hot reload or a second tap.
Gate Firestore listeners on FirebaseAuth.instance.authStateChanges() and only build the stream once the user isn't null. If sign-in itself fails only in the Play Store build, the problem is upstream of Firestore; our guide to Google Sign-In failing after publishing to the Play Store covers the SHA-1 fix.
3. Does your query ask for documents the rules won't allow?
This is the classic one: "security rules are not filters". Firebase's query guide explains that rules evaluate a query against its potential result set, and "if a query could potentially return documents that the client does not have permission to read, the entire request fails". The rule doesn't quietly drop the documents you can't see.
So with a rule like allow read: if request.auth.uid == resource.data.author, this query fails even if most documents belong to the user:
FirebaseFirestore.instance.collection('stories').snapshots();
and this one passes, because the filter matches the rule:
FirebaseFirestore.instance
.collection('stories')
.where('author', isEqualTo: FirebaseAuth.instance.currentUser!.uid)
.snapshots();
Firebase notes this all-or-nothing behaviour applies to queries, not to fetching a single document by ID, which is why doc(id).get() can work while the list screen fails. Narrower queries also cut billed reads; see why Firestore reads are too high in a Flutter app.
4. Does the rule cover the subcollection you're reading?
Not unless you wrote it. A match /users/{userId} block applies to documents in users, not to users/{userId}/orders. Add a nested match, or a recursive wildcard if the same condition really should apply to everything below:
match /users/{userId}/{document=**} {
allow read, write: if request.auth != null && request.auth.uid == userId;
}
Use the wildcard deliberately: it grants the same access to every future subcollection too. Our Firestore security rules review cadence is a good place to catch wildcards that have grown too broad.
5. Does the write break a data condition?
If reads work and one write fails, check conditions on request.resource.data, the document as it would look after the write. A rule that requires a field such as author to equal the user's UID rejects any write that leaves it out, sends a different value, or changes it on update.
In the Rules Playground, choose a write, set the location, pick "authenticated" with a test user ID, paste the document data your app sends, and run it. The banner tells you which line denied it.
6. Is App Check enforcement blocking debug builds?
Very likely, if release builds work and debug builds or emulators fail. Firebase's App Check docs say that once enforcement is on, "all unverified requests to that product will be rejected", and that emulators and CI environments "don't qualify as valid devices". Enforcement can take up to 15 minutes to take effect, so a failure can start a little after you flip the switch.
For debug builds, activate the debug provider, copy the debug token from the logs into the App Check section of the Firebase console, and keep that token out of public repos and release builds, as Firebase warns. Our guide to App Check across staging and production Flutter builds covers the setup.
7. Are the rules you're reading the rules that are live?
Not always. Updated rules can take up to a minute to affect new queries and up to 10 minutes to reach active listeners, according to Firebase. Beyond that, check three things: A callable can also fail before your Firestore rules run; see how to diagnose UNAUTHENTICATED on a Flutter callable.
- The app's
firebase_options.dartpoints at the same project you deployed to. Runfirebase deploy --only firestore:rules --project your-project-idwith the project named explicitly. - If you use more than one Firestore database, each has its own rules; the app may be talking to a different one than you edited.
- The console's rules editor and your local
firestore.rulesfile match, so a later CLI deploy doesn't overwrite a console fix.
If the app also misbehaves only in release mode for other reasons, see why a Flutter app works in debug but not in release.
How do you find the exact rule that denied the request?
Reproduce the request in the Rules Playground or the Firestore emulator rather than guessing. Firebase recommends the emulator for testing rules locally before you deploy, and the Playground lets you pick the operation, path, authentication state and document data, then shows which condition failed. Test with the same user ID and the same filters your Flutter code sends, including the where clauses; a query with different filters is a different request as far as rules are concerned. If uploads fail too, see the Firebase Storage "unauthorized" error and how to find the rule that denies it.
Want to see the apps we build this way? They're listed on the GSPTeck homepage, with links to their official Google Play listings. If the error says an index is missing instead of a permission, see the Firestore "query requires an index" error in Flutter.
FAQ
What does cloud_firestore/permission-denied mean in Flutter?
It means Firestore Security Rules rejected the read or write. The plugin is passing on the server's PERMISSION_DENIED error, so the fix is in your rules, your query or your sign-in state.
Is allow read, write: if true a safe fix?
No. Firebase warns that open rules let anyone who guesses your project ID read, modify or delete your data. Use it only in the local emulator, never on a deployed project.
Why does a single document load but the list query fails?
Because rules are not filters. A query fails if it could return any document the user can't read, while a single document fetch is checked on its own. Add the same filter the rule checks to the query.
How long do new Firestore rules take to apply?
Up to a minute for new queries and listeners, and up to 10 minutes to fully reach active listeners, according to Firebase. Restart the app before assuming a deploy didn't work.
Sources
- Firebase: Get started with Cloud Firestore Security Rules (last updated 2026-11-12, checked 2026-11-15)
- Firebase: Securely query data, "Rules are not filters" (checked 2026-11-15)
- Firebase: Fix insecure rules and the Rules Playground (checked 2026-11-15)
- Firebase: Cloud Firestore quickstart, test mode and production mode (checked 2026-11-15)
- Firebase: Enable App Check enforcement and the App Check debug provider for Flutter (checked 2026-11-15)