Search code examples
firebasefirebase-security

Firebase Firestore rules resource.data not working


Can somebody please explain why this rule

match /invoices/{id} {
        allow read, update, delete: if request.auth.uid == resource.data.uid;
} 

giving me nothing, but when this:

match /invoices/{id} {
        allow read, update, delete: if request.auth.uid == 'gkaT45c7gYXCqQpw5al6Fbh9fgC3';
}

is working

enter image description here


Solution

  • solved the problem by changing the query and created an index relying on the new query variable