I'm sure I've set up the app in the firebase console.
I'm trying to set up app check for our ios app. I'm intending to use it to secure a functions call. I've verified that the function works when I don't throw an error on looking for the app check. However, I'm not seeing context.app
.
I've added a sanity check by calling getToken
on the mobile app and I'm running into the following error
NativeFirebaseError: [appCheck/token-error] The operation couldn’t be completed. Too many attempts. Underlying error: The operation couldn’t be completed. The server responded with an error:
- URL: https://firebaseappcheck.googleapis.com/v1/projects/<Redacted>/apps/<Redacted>:exchangeDeviceCheckToken
- HTTP status code: 400
- Response body: {
"error": {
"code": 400,
"message": "App not registered: <Redacted>.",
"status": "FAILED_PRECONDITION"
}
}
I've checked the firebase app check console and I have the following:
- The appcheck console has this app registered with device check and app attest.
- The device check configuration uses the p8 file I set up for device check in the apple developer portal.
- The id that I redacted above is the id in the relevant google.plist file.
The only thing I'm not doing that's in the docs is setting up debug tokens, but my understanding is that's for CI and simulator environments. I'm testing on a physical device with an expo development build. Is there something I'm missing for set up?
Here is the init code I'm using
async function initiateAppCheckSecurity () {
const provider = appCheck().newReactNativeFirebaseAppCheckProvider();
await provider.configure({
/** @todo set up android */
apple: {
provider: 'appAttestWithDeviceCheckFallback',
},
});
await appCheck().initializeAppCheck({ provider, isTokenAutoRefreshEnabled: false });
// sanity check
const blah = await appCheck().getToken();
// error thrown here.
console.log({ blah });
}