I am using firebase auth REST api to do authentication; this part works fine as I can log in/sign up users and I can get a uid and auth token back.
When trying to write to cloud firestore, if I set my Cloud Firestore database rule to (which is one of the most basic auth rules):
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write: if request.auth.uid != null;
}
}
}
But how to pass in the uid to the a cloud firestore request using cloud_firestore package e.g. I want to write to a collection:
Firestore.instance.collection('myCollection').document() .setData(myData);