Having a problem reading a doc from a Cloud Firestore collection. The issue is I get an exception of ErrorType: PermissionDenied and this message "Missing or insufficient permissions."
nugets: FirebaseAuthentication.net(3.6.0) Plugin.CloudFirestore(4.1.0)
public async Task<IDocumentSnapshot> GetUserAndPopulate()
{
var doc = await CrossCloudFirestore.Current
.Instance
.Collection("users")
.Document(AccountManager.CurrentUserId)
.GetAsync();
return doc;
}
the CurrentUserId is populated after sign and is correct. Each document in the users collection has a document ID of the userID in Cloud Firestore.
Below are the security rules for read and write access to the documents in users collection.
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /users/{user_id}{
allow read, write: if request.auth != null && request.auth.uid == user_id;
}
}
}
I know that the request is being seen as not authenticated but I really don't know why?
Any Advice would be greatly appreciated.
Thanks!