Reputation: 3005
I am following the answers in the below link to use the "request.auth.uid" to filter the records for an user. Issue in authentication in firebase cloud firestore at user level
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read: if request.auth.uid != null && resource.data.createdBy == request.auth.uid;
allow write: ....
}
}
}
Question
Upvotes: 2
Views: 2233
Reputation: 1145
For example: {"uid": "iMuWxlrQYbQUoiAsH9N6bCPe37Hi", ..}
Upvotes: 0
Reputation: 6263
request.auth.uid
represents the user ID for the Firebase User.
As long as the user is logged in, Firestore automatically sends the values, there is no need for you to manually do that.
Upvotes: 1
Reputation: 317402
request.auth.uid
will contain the UID of the user who has been authenticated with Firebase Authentication.Upvotes: 2