I am growing a firebase perform for an previous ios app. It is working okay and I want to add AppCheck to it, however I am battling this.
That is what I’ve now.
I my podfile:
pod 'FirebaseFunctions', '10.5.0'
In my AppDelegate.m file:
[[_functions HTTPSCallableWithName:@"isMyFunctionActive"] callWithCompletion:^(FIRHTTPSCallableResult * _Nullable consequence,
NSError * _Nullable error) {
// Handle response
}];
And my firebase perform is that this:
const {onCall} = require("firebase-functions/v2/https");
exports.isMyFunctionActive = onCall((request) => {
return {
isMyFunctionActive: true,
};
});
That is working OK. So as to add AppCheck I’ve carried out this:
In my firebase console I’ve registered App Attest for my challenge iOS app.
I’ve added AppCheck pod and I’ve made a pod set up:
pod 'FirebaseFunctions', '10.5.0'
pod 'FirebaseAppCheck', '10.5.0'
I’ve added this to my AppDelegate:
- (BOOL)software:(UIApplication *)software didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
...
FIRAppCheckDebugProviderFactory* providerFactory = [[FIRAppCheckDebugProviderFactory alloc] init];
[FIRAppCheck setAppCheckProviderFactory:providerFactory];
...
}
I’ve left my firebase perform name because it was.
Lastly I’ve added enforceAppCheck to my firebase perform:
const {onCall} = require("firebase-functions/v2/https");
exports.isMyFunctionActive = onCall({enforceAppCheck: true}, (request) => {
return {
isMyFunctionActive: true,
};
});
With these adjustments, each time my app calls the firebase perform it receives an Unauthenticated error.
Which is the explanation? I assume I am unsuitable, however I assumed that the configuration of FIRAppCheck in didFinishLaunchingWithOptions would retailer internally the token (the truth is my app logs present Firebase App Examine debug token: ‘…’) and this token can be mechanically added to firebase capabilities calls.