-
`on iOS In certain react-native testing scenarios it may be difficult to access the shared secret, but the react-native-firebase testing app for e2e testing does successfully fetch App Check tokens via setting an environment variable and initializing the debug provider before firebase configure in AppDelegate.m for iOS.` sry for the second dump question. Does anyone has an working example how to get expo with eas configured to get also the simulator working with AppCheck / Device Check? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 17 replies
-
Hey there It's not all different between non-Expo and Expo. At the end, you're running an app on a device. There is not a magically-different way to do everything just because Expo is involved, though it does seem that way to me sometimes Configure an AppCheck debug token in the Firebase web console react-native-firebase/package.json Line 45 in ef7895c |
Beta Was this translation helpful? Give feedback.
-
@mikehardy I tried to get it working with different options ;) thats my sh file this is working and sets an env variable for the simulator with the name FIRAAppCheckDebugToken as wished and documented. probably did I do something wrong ? thx |
Beta Was this translation helpful? Give feedback.
-
@mikehardy sry for disturbing you one more time. I was checking everything the whole weekend and I found the following in the app-check package from react native firebase `// TODO // Write a custom provider factory, and allow the AppAttest provider` As far as I understood the documentation from firebase we need to initiate the debug provider when we are running in the simulator. Could it be that just this code is missing ? so that the environment variable that we set is not really used? thx for your thoughts |
Beta Was this translation helpful? Give feedback.
-
In
in const {
withAppDelegate,
createRunOncePlugin,
} = require("@expo/config-plugins");
const RNFI_CONFIGURE = `[FIRApp configure];\n`;
const RNFI_CONFIGURE_WithDEBUGAPPCHECK = `[RNFBAppCheckModule sharedInstance];\n`;
const withCustomAppCheck = (config) => {
return withAppDelegate(config, async (config) => {
// Add import
if (!config.modResults.contents.includes('#import "RNFBAppCheckModule.h"')) {
config.modResults.contents = config.modResults.contents.replace(
/#import "AppDelegate.h"/g,
`#import "AppDelegate.h"\n#import "RNFBAppCheckModule.h"`,
);
}
if (
config.modResults.contents.includes(RNFI_CONFIGURE) && !config.modResults.contents.includes(RNFI_CONFIGURE_WithDEBUGAPPCHECK)
) {
const block = RNFI_CONFIGURE_WithDEBUGAPPCHECK + RNFI_CONFIGURE;
config.modResults.contents = config.modResults.contents.replace(
RNFI_CONFIGURE,
block
);
}
return config;
});
};
module.exports = createRunOncePlugin(withCustomAppCheck); After changing above two files, we need sync the ios folder with command
and remaining steps as In iOS simulator it test pass for version |
Beta Was this translation helpful? Give feedback.
@mikehardy sry for disturbing you one more time. I was checking everything the whole weekend and I found the following in the app-check package from react native firebase
`// TODO
// - set up DeviceCheckProvider and Debug provider
// FIRAppCheckDebugProviderFactory *providerFactory =
// [[FIRAppCheckDebugProviderFactory alloc] init];
// [FIRAppCheck setAppCheckProviderFactory:providerFactory];
// Write a custom provider factory, and allow the AppAttest provider`
https://github.com/invertase/react-native-firebase/blob/ef7895cd49eed3a4d103df624e52315250c68ab3/packages/app-check/ios/RNFBAppCheck/RNFBAppCheckModule.m
As far as I understood the documentation from firebase we need to initiate t…