Welcome to our special page which is very important to increase security of your firebase apps, it will help to minimize threats on your server. It is recommended to learn firebase very well. how to handle huge data in more efficient way before security rules.
Tags
Firebase Rules
Firebase Real-time Database:
1. No Security:
{
"rules": {
".read": true,
".write": true
}
}
2. Close server (No access):
{
"rules": {
".read": false,
".write": false
}
}
3. Only Authenticated Users can read & write the data:
{
"rules": {
".read": "auth != null",
".write": "auth != null"
}
}
4. Only user can read & write his own data:
{
"rules": {
"posts": {
"$uid": {
".read": "$uid === auth.uid",
".write": "$uid === auth.uid"
}
}
}
}
Note: You should also make sure that the keys of user data should be authenticated UID otherwise it won't work.
5.Only Admins can read & write the data:
{
"rules":{
"announcements":{
".read": true,
".write": "root.child('badges/admin/' + auth.uid).exists()"
}
}
}
6.Only Particular User can write:
{
"rules":{
".read": true,
".write": "auth.uid == 'pasteYourUID' "
}
}
7.Only Users having verified emails can write:
{
"rules":{
".read": true,
".write": "auth.token.email_verified === true"
}
Firebase Storage Rule
1.Security
rules_version = '2'; service firebase.storage { match /b/{bucket}/o { match /{allPaths=**} { allow read; allow write: if request.auth.uid == 'your uid'; } } }
Subscribe Our Newsletter
0 Comment
Post a Comment