1. Are you ready for the Galaxy S20? Here is everything we know so far!

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

Discussion in 'Android Development' started by ibrmrt, Nov 10, 2020.

  1. ibrmrt

    ibrmrt Lurker
    Thread Starter

    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 (Text):
    1.  
    2.  
    3. rules_version = '2';
    4. service cloud.firestore {
    5.   match /databases/{database}/documents {
    6.    match/Notes/{noteId}{
    7.    allow read, write: if request.auth.uid != null ;
    8.  
    9.        }
    10.    }
    11. }
    12.  
    13.  
    and this is my cloud firestore ;


    [​IMG]
     



    1. Download the Forums for Android™ app!


      Download

       
Loading...

Share This Page

Loading...