Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

188
Views
Firebase rules - Allow read if user's uid equals document's field value userId

I am trying to only allow reads coins's documents if the user's uid matches the userId (encircled in red).

enter image description here

rules_version = '2';
service cloud.firestore {
  match /databases/{database}/documents {
    
    match /{document=**} {
        allow read, write: if false;
    }
    
    match /coins/{coinId} {
        allow read: if request.auth != null && resource.data.userId == request.auth.uid;
        allow write: if request.auth != null;
    }
  }
}

This rule returns an error in the console when I log into my account. And no data is displayed. Uncaught error in snapshot listener: FirebaseError: Missing or insufficient permissions.

Based on everything I've read here it seems like the following code should work, but it doesn't.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!