• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

How users can only see their own data in Cloud Firestore?

ibrmrt

Lurker
Nov 10, 2020
1
0
I'm building an app with Kotlin. In the app, the user can sign up and log in. After the user log in, the user adds some text and pictures, and these data is successfully added to the firebase cloud store and displayed in the app as a list. However, this list can be accessed by anyone registered on the app.

What I want to do is how users can only see their own data. So I don't want users to see each other's data. I just want every user to see their own added data. I think that I need to change Firebase Cloud Strore rules but How?.

I'm new about this, Thank you !

This is Cloud Firestore Rules;

Code:
rules_version = '2';
service cloud.firestore {
  match /databases/{database}/documents {
   match/Notes/{noteId}{
   allow read, write: if request.auth.uid != null ;
  
       }
   }
}

and this is my cloud firestore ;


f1esi.png
 

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones