first of all, I'm a beginner, I would like to know if anyone knows how to protect the firebase database, like has a certain link created automatically: example: https://example.firebaseio.com/.json If a user accesses it, they can see the entire JSON and copy. How can I stop this?
That's what Firebase Real Time Database Rules are for. When rules are set up correctly and someone attempts to access that address they will see this
{
"error" : "Permission denied"
}
There's a great guide to get you started Understand Firebase Realtime Database Rules
Note that the default rules for Real Time database will produce that error. Here they are for reference.
{
"rules": {
".read": "auth != null",
".write": "auth != null"
}
}
And you can test it by opening web brownser and navigating to
https://your-database.firebaseio.com/.json
If you're using Firestore, the rules are a bit different so here's a link for those Structuring Cloud Firestore Security Rules
Based on a comment, the Firebase Real Time Database can also be disabled through the Firebase console.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.