I’m having a hard time with my iOS app that’s already in the App Store. I can’t get Firebase to accept my App Check token. The app works fine when I set the rules to allow all access, but when I try to enforce App Check, I get a “Missing or insufficient permissions” error.
I’ve done the following:
- Set up DeviceCheck and App Attest in Firebase
- Turned on App Check enforcement
- Added the correct GoogleService-Info.plist file
My code seems to get App Check tokens, but Firestore access still fails. Here’s a simplified version of what I’m trying:
func checkAppAndFirestore() {
AppCheck.shared.getToken { token, error in
if let token = token {
print("Got token: \(token.token)")
self.testFirestore()
} else {
print("Token error: \(error?.localizedDescription ?? \"Unknown\")")
}
}
}
func testFirestore() {
Firestore.firestore().collection("tests").document("sample").getDocument { doc, error in
if let error = error {
print("Firestore error: \(error.localizedDescription)")
} else {
print("Firestore success: \(doc?.data() ?? [:])")
}
}
}
I’m out of ideas and need help getting App Check to work properly. Any suggestions?