Symptom: Firestore permission denied by Security Rules
Firestore denies client requests that your Security Rules don't explicitly allow, and locked-mode or expired test-mode rules deny everything. Write rules that allow each operation for the right signed-in user and test them in the Rules Playground.
Cause: Security Rules don't allow this read/write for this user, or test-mode rules expired.
How to fix it
- Check the rules in the Firebase console; test-mode rules expire after a date.
- Write rules per collection that check
request.auth.uid. - Make sure the user is signed in before the query runs.
- Test with the Rules Playground or emulator before deploying.
Example
Illustrative example, not from a customer project.
match /todos/{id} {
- allow read, write: if false;
+ allow read, write: if request.auth != null && request.auth.uid == resource.data.uid;
}
FAQ
It worked last month and suddenly stopped.
Test-mode rules include an expiry date.
Should I allow everything?
No. Open rules let anyone read or modify your data.
QUICK FIX · $49 · THIS ERROR ONLY
Get this exact error fixed — $49 Quick FixFixed within scope, or we keep working until it is · Read-only access Not sure it's this error? $149 diagnosis
- Fixed, or we keep working free until it is (within the written scope).
- A human reviews every fix before it ships.
- Read-only access; fixes arrive as pull requests you merge.
- Your $149 diagnosis is credited in full toward any paid job.
One error, one root cause, fixed in your app. If it turns out bigger, we tell you before doing more, and your $49 is credited toward the fix, diagnosis or Launch Path if you book within 14 days. Fixing three? The 3-Error Pack is $119.
Bigger job: More than one auth or data issue? Auth & database security fix, from $400.
Built with Lovable, Bolt, Replit, Cursor or v0? See rescue by platform and the security checklist.