Reputation: 936
I want to secure my firestore data. I have an app that accesses the data from firestore. Currently, my rules allow anyone to read and write. How can I access the data using a key I have in the app? Sort of verify a key before anyone can read or write data.
Here are my current rules:
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write: if true;
}
}
}
https://gyazo.com/da26189ac1c5bbdea8d374ad8870bd7f - this is why I am asking
Upvotes: 0
Views: 58
Reputation: 598740
The security rules of your Firestore database only have access to:
There is no way to pass custom data to the security rules in another way, so anything you need will have to be in one of these.
So if you want to pass custom data in both read and write operations, you'll have to do so in either the path or make it part of the user's token, for example by setting a custom claim in there.
Also see:
Upvotes: 2