Firestore Permission Denied in Flutter? 7 Causes and Fixes (2026)

By · Published 2026-11-15 · Last verified 2026-11-15

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.

Grid of seven causes of Firestore permission denied in Flutter: production mode rules, a user not signed in yet, a query broader than the rules, a subcollection without a rule, a write that fails a data condition, App Check enforcement and rules deployed to the wrong project
Seven causes of a Firestore permission-denied error in Flutter.

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.

#CauseTypical symptomFix
1Database created in production (locked) modeEvery read and write failsWrite rules for each collection you use
2User isn't signed in yetFails on cold start, works laterWait for authStateChanges() before querying
3Query asks for more than the rules allowSingle document works, list query failsAdd the same where filter the rule checks
4Rule doesn't cover a subcollectionParent works, child path failsAdd a match for the subcollection
5Write fails a data conditionReads work, one write failsCheck request.resource.data fields
6App Check enforcementFails in debug builds or emulators onlyRegister a debug token
7Rules not deployed, or deployed elsewhereConsole rules look right, app still failsDeploy 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.

Two columns comparing a Firestore query that fails because it asks for every story while the rule allows only the user's own, with a query that passes because it filters on the author field the rule checks
Rules are not filters: the query has to match the rule.

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.

Four boxes of debugging a denied Firestore request: reproduce the exact request, test it in the Rules Playground or emulator with the same user and data, read which condition failed, then deploy with an explicit project and wait up to 10 minutes
Finding the rule that denied a request.

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.

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.

Vertical Pinterest graphic with five fixes for Firestore permission denied errors in a Flutter app
Pinterest pin: Firestore permission denied 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