Skip to content Skip to sidebar Skip to footer

How To Update Security Rules For Firestore Database?

I just receive an email from firebase which is: Email Title: [Firebase] Client access to your Realtime Database connectsocialmediaapp-default-rtdb is expiring in 5 day(s) Email Des

Solution 1:

You can set your rules as follows:

rules_version = '2';
service cloud.firestore {
  match /databases/{database}/documents {
    match /{document=**} {
      allow read, write: if request.auth != null;
    }
  }
}

This rule above will allow only authenticated users to access/write data to your database. Please do note that any user can access all the information in your Firestore if you set the rules to if true;. You can checkout this link for some common security rules and their user cases. Here is the link to official documentation for Firestore security rules.

allow read, write: if false;

You can set this rule to disable users' access to the database.

Post a Comment for "How To Update Security Rules For Firestore Database?"