Cloud Firestore and Remote config services are using in my app. In debug mode all works fine. But the app release build istalled from Play Store (internal testing) doesn't work.
Google sign-in (using OAuth) in my app works as expected after adding another one SHA-1 key (taken from Play Console) to Firebase app release config. But Cloud Firestore and Remote config still don't.
Log: Stream closed with status: b1 {code=PERMISSION_DENIED...}
It looks like I had missing something. Also, how can I get release logs of the app? Any thoughts, thanks.
UPD It seems the problem in rules, so my rules are:
Firestore DB rules:
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /stories/{storyId}{
allow read, write: if resource.data.userId == request.auth.uid || request.resource.data.userId == request.auth.uid;
match /sentences/{itemId}{
allow read, write: if request.auth != null;
}
}
}
}
Query to read look like this:
Firebase.auth.uid?.let { userId ->
db.collection("stories")
.whereEqualTo("userId", userId)
.whereEqualTo("hasBookmarks", true)
.orderBy("createdAt", Query.Direction.DESCENDING)
.addSnapshotListener { value, e ->
//result handling code
}
}