Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting firestore security rules without using Firebase Authentication

I have an angular web application and I am not using Firebase Authentication, for logging in my users, as it's done via a service.

Right now, my firestore account has full access, anyone can perform any operation.

I read the documentation of security rules and everywhere it mentioned firebase auth. Is there a way to define rules, without using firebase auth?

like image 378
Marium Malik Avatar asked Jan 07 '19 23:01

Marium Malik


People also ask

How do I set Firebase firestore rules?

To set up and deploy your first set of rules, open the Rules tab in the Cloud Firestore section of the Firebase console. Write your rules in the online editor, then click Publish.

How do I secure my firestore database?

Firestore offers robust access management and authentication through two different methods, depending on the client libraries you use. For mobile and web client libraries, use Firebase Authentication and Firestore Security Rules to handle serverless authentication, authorization, and data validation.

What file should be used for firestore rules firestore rules?

rules // is a file used to define the security rules for your Firestore database. firestore. indexes. json // is a file used to define indexes for you Firestore queries.

How do you secure Firebase rules?

How do they work? Firebase Security Rules work by matching a pattern against database paths, and then applying custom conditions to allow access to data at those paths. All Rules across Firebase products have a path-matching component and a conditional statement allowing read or write access.


1 Answers

You can certainly use security rules without Firebase Auth, but you won't be able to write any rules that depend on identifying the individual user. To put it more specifically, you will not be able to use the auth variable effectively at all, since it's only populated with data from Firebase Auth.

Without auth information, all you'll be able to do is check the contents of documents to be created or modified. Yout won't be able to defined secure per-user rules.

like image 163
Doug Stevenson Avatar answered Oct 12 '22 13:10

Doug Stevenson