Create Protected User Directories in Firebase Cloud Firestore

Опубликовано: 06 Октябрь 2024
на канале: Brandan Jones
470
8

Integrate Firebase Authentication and Firebase Cloud Firestore Database to create partitions of user data in that are protected bu Firebase Auth. In previous videos, I set up and configured Firebase Auth and Firebase Cloud Firestore Database in our Jetpack Compose Android App with Kotlin. In this video, I create a User data class that stores a uid from FirebaseUser, then I create a collection called users in Firebase Cloud Firestore. That collection holds our objects of our User data class, which are keyed by the Firebase Auth uid for each user. Under that user document, I store user-specific data. I add authentication rules to the Firebase Cloud Firestore, so that users can only access data in their own private directories. I adjust the save and listen functions in the MainViewModel to save and listen to data in user directories exclusively. I also do quite a bit of null checking.

All source code is freely available in GitHub: https://github.com/discospiff/MyPlant...
This video is part of a playlist on creating Android apps with Jetpack Compose, which is avialable here:    • Create an Android app with Jetpack Co...