I used FireStore for a project that works fine in the browser, but when I port the code to Expo, running on iOS 11.2 iPhone X in the simulator, it continues to raise Error: Missing or insufficient permissions.
Auth works fine, and when I check the client in the Firestore collection object, the corresponding UID is set and the same code is tested in the browser, everything works fine (without permission). I'm trying to say that I'm 95% sure that the problem is with the Firebase lib / react native / expo combination, and not with my code. Moreover, it seems that referring to the Firestore in the browser, there is a set of headers, but when debugging a call in Reactotron (from Expo), it seems that the call created by Firebase lib does not have headers at all.
I doubt it matters, but here are my auth rules:
service cloud.firestore { match /databases/{database}/documents { match /UserData/{userID} { allow read, write: if request.auth.uid == userID; } match /MemberData/{userID} { allow read: if request.auth.uid == userID; } } }
The call I was trying to make (and there is certain data in the document):
profile = (await UserDataCollection.doc(`${idToken.uid}`).get()).data();
I am curious if anyone else has run into this problem, and if so, are there any workarounds to get Firestore working?
ios react-native firebase-security expo google-cloud-firestore
raphaeltm
source share