Hi Guys,
From one day to the next my firebase rules stopped working.
The ruleset below used to work both from my app and the firebase console. Then the next time I used firebase console and my app I could not see my database data except for the user table.
'service cloud.firestore {
match /databases/{database}/documents {
match /Studio/{id} {
allow read, write, delete: if studioAccessAllowed(request.auth.uid,id);
allow create:if request.auth.uid != null;
}
match /Studio/{id}/{document=**} {
allow read, write, delete: if studioAccessAllowed(request.auth.uid,id);
allow create:if request.auth.uid != null;
}
match /User/{user}{
allow read, write, delete, create;
}
function studioAccessAllowed(userUid,id) {
return get(/databases/$(database)/documents/User/$(userUid)).data.studioID == id;
}
}
}
What I did find out is that the request.auth object is null because I can see my data with the following rules.
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write: if request.auth == null;
}
}
}
I cannot see a code change having caused this and besides why did the firebase console stop working with my original rules and now work with "if request.autt == null"
I am stumped and need help.