My database structure is:
users
[email protected]
records
ApK2DFpG87NDGYutgAVO
pulse: 80
Bryd87NAS20dfDGYtghg
pulse: 78
[email protected]
records
A81hxASDKH38dhaj9321
pulse: 93
A82ndasklih38ASD2eda
pulse: 67
and rules are:
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /users/{email} {
allow create, read, update, delete: if request.auth.token.email == email;
}
}
}
I would like every user (e.g. [email protected]) to be able to read and write data only under that user (users/[email protected]/**).
When I read users/[email protected] in the Rules playground (while being authenticated as [email protected]), I get "Simulated read allowed", as expected.
However, when I read users/[email protected]/records from my app (while being authenticated as [email protected]), I get:
FirebaseError: Missing or insufficient permissions.
What am I missing?
By the way, why the Rules playground doesn't allow reading collections (e.g. users/[email protected]/records)? It says:
Path must be document-level