Follow us to get updates related to latest posts Follow Now!

Basic Firebase Security Rules for Sketchware Apps

Please wait 0 seconds...
Scroll Down and click on Go to Link for destination
Congrats! Link is Generated
Basic Firebase Security Rules for Sketchware Apps


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. 

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';
    }
  }
}

1 comment

  1. Dharmjeet Singh
    This comment has been removed by a blog administrator.
Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
Site is Blocked
Sorry! This site is not available in your country.