0
votes

I have created a database cloud firestore. In this database I want anyone to be able to read and write if: request.auth.uid != null now an facing a permission problem when someone is trying to login or sign up using email and password with firebase authentication. I get insufficient permission. How can I let any of my users sign up and login at the same time protect the other part of the database

1
Please edit the question to show the entire set of rules along with the specific query that's not working the way you expect. - Doug Stevenson

1 Answers

0
votes

This rule should be good enough.

service cloud.firestore {
  match /databases/{database}/documents {    
    match /YOUR_COLLECTION_NAME/{doc} {
       allow write, read: request.auth.uid != null
    }
  }
}

But are you sure you are setting your authentication properly?

Check Authentication -> Sign-in Method and make sure you enable the providers you need. Using the Firebase sdk for auth you will be able to pass this validation after you log in your user. Take a look a this