I have authenticated Firebase through the Moralis extension. How do I get the user’s wallet address in the firestore.rules? I want to limit users to only modify their own document (defined by the lower case of their wallet address) in the users collection. Here’s my code snippet
match /users/{userId}/{document=**} {
allow read: if true;
allow write: if request.auth != null && request.auth.token.name.toLowerCase() == userId;
}.
But it doesn’t work. The error I encounter is not sufficient permission when I try to write to the collection. The error is at request.auth.token.name.toLowerCase() == userId
Any help is much appreciated.