Cloud Firestore: Missing or Insufficient Permissions

I get (on Android):

com.google.firebase.firestore.FirebaseFirestoreException: PERMISSION_DENIED: Missing or insufficient permissions

using these safety rules:

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

My application seems to be authenticated correctly with FirebaseAuth , since mFirebaseAuth.getCurrentUser().getUid() returns the correct user ID.

Is there something I'm doing wrong?

+7
android firebase firebase-authentication google-cloud-firestore
source share
3 answers

Edit: I just want to say that I managed to fix the problem by lowering it to 4.6.2. I have more details in this post.

Pre-editing: This has been happening to me since I updated the reaction to my native language, and I canโ€™t let my life determine the problem. I debugged it and my user definitely authenticated during the request, I checked this by running below and I have a uid there.

 firebase.auth().currentUser 

So, the next thing I wanted to do was check the session in the actual request to see what was happening. I added a code snippet to the entry point of my application-application.

 XMLHttpRequest = GLOBAL.originalXMLHttpRequest ? GLOBAL.originalXMLHttpRequest : GLOBAL.XMLHttpRequest 

and when I run this code, it magically works again. This is delegating requests through the browser, although this is probably not a true test.

So, I launched Charles and compared requests for my new reactive assembly with my old [working] reaction-native assembly. The queries look the same to me, though (with the exception of another sessionId), so I have no idea. The downside is the lack of debugging tools through the firestore console.

My desire is to say that some of the auth headers have expired / cached and that this is not a firestore. Putting your head on the table at this moment

+3
source share

I contacted the Firebase support team directly, as this problem was very important for our service, and I received an email below. They seem to have fixed the error now.

Please let me know if the problem recurs.

Hi,

We just confirmed by our engineers that this sporadic issue with our Safety Rules for Firestore was a known mistake, but it was already fixed today. Please check your safety rules again and let us know if you are still encountering a problem.

Regards, Kevin

+1
source share

This seems to be a Firestore issue (in beta today) and not on the client side.

0
source share

All Articles