Tech stack
react native
with @react-native-firebase
Working Launch Construct
On xcode I’m utilizing Construct Configuration
of Launch
to run app on a bodily system.
Error proven in console when app begins
[javascript] [Error: [appCheck/token-error] The operation couldn’t be accomplished. The server responded with an error:
- URL: https://firebaseappcheck.googleapis.com/v1/initiatives/##########/apps/##########:exchangeDebugToken
- HTTP standing code: 403
- Response physique: {
"error": {
"code": 403,
"message": "App attestation failed.",
"standing": "PERMISSION_DENIED"
}
}
]
Look the above has exchangeDebugToken
within the url
Javascript Initialization
async perform initAppCheck() {
const appcheck = firebase.appCheck();
const rnfbProvider = appcheck
.newReactNativeFirebaseAppCheckProvider();
await rnfbProvider.configure({
android: {
supplier: __DEV__ ? 'debug' : 'playIntegrity',
debugToken: 'fba7bbac-8440-4965-b5f2-8c020bd042c3',
},
apple: {
supplier: 'appAttestWithDeviceCheckFallback',
},
net: {
supplier: 'reCaptchaV3',
siteKey: 'unknown',
},
});
await appcheck.initializeAppCheck({
supplier: rnfbProvider,
isTokenAutoRefreshEnabled: true,
});
const token = await appcheck.getToken(true);
}
__DEV__
is false
when logged.
Pod File:
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
platform :ios, min_ios_version_supported
prepare_react_native_project!
flipper_config = FlipperConfiguration.disabled
# flipper_config = ENV['NO_FLIPPER'] == "1" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled
linkage = ENV['USE_FRAMEWORKS']
if linkage != nil
Pod::UI.places "Configuring Pod with #{linkage}ally linked Frameworks".inexperienced
use_frameworks! :linkage => linkage.to_sym
finish
goal 'BusinessClientApp' do
config = use_native_modules!
use_frameworks! :linkage => :static
# pod 'Firebase', :modular_headers => true
# pod 'FirebaseCore', :modular_headers => true
# pod 'GoogleUtilities', :modular_headers => true
# pod 'FirebaseCoreExtension', :modular_headers => true
# pod 'FirebaseAppCheckInterop', :modular_headers => true
# pod 'FirebaseAuthInterop', :modular_headers => true
# pod 'FirebaseMessagingInterop', :modular_headers => true
# pod 'GTMSessionFetcher', :modular_headers => true
# pod 'FirebaseStorageInternal', :modular_headers => true
# pod 'FirebaseCoreExtension', :modular_headers => true
# Flags change relying on the env values.
flags = get_default_flags()
use_react_native!(
:path => config[:reactNativePath],
# Hermes is now enabled by default. Disable by setting this flag to false.
# Upcoming variations of React Native could depend on get_default_flags(), however
# we make it express right here to help within the React Native improve course of.
:hermes_enabled => flags[:hermes_enabled],
:fabric_enabled => flags[:fabric_enabled],
# Allows Flipper.
#
# Be aware that you probably have use_frameworks! enabled, Flipper won't work and
# it's best to disable the subsequent line.
:flipper_configuration => flipper_config,
# An absolute path to your utility root.
:app_path => "#{Pod::Config.occasion.installation_root}/.."
)
goal 'BusinessClientAppTests' do
inherit! :full
# Pods for testing
finish
post_install do |installer|
react_native_post_install(
installer,
# Set `mac_catalyst_enabled` to `true` with the intention to apply patches
# obligatory for Mac Catalyst builds
:mac_catalyst_enabled => false
)
__apply_Xcode_12_5_M1_post_install_workaround(installer)
finish
finish
App Delegate.mm
#import "AppDelegate.h"
#import "RNFBAppCheckModule.h" // https://rnfirebase.io/app-check/utilization
#import <Firebase.h>
#import <React/RCTBundleURLProvider.h>
@implementation AppDelegate
- (BOOL)utility:(UIApplication *)utility didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Firebase config
[RNFBAppCheckModule sharedInstance]; // ⬅️ ADD THIS LINE BEFORE [FIRApp configure] https://rnfirebase.io/app-check/utilization
[FIRApp configure];
self.moduleName = @"BusinessClientApp";
return [super application:application didFinishLaunchingWithOptions:launchOptions];
}
- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
#if DEBUG
return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
#else
return [[NSBundle mainBundle] URLForResource:@"predominant" withExtension:@"jsbundle"];
#endif
}
/// This technique controls whether or not the `concurrentRoot`function of React18 is turned on or off.
///
/// @see: https://reactjs.org/weblog/2022/03/29/react-v18.html
/// @notice: This requires to be rendering on Material (i.e. on the New Structure).
/// @return: `true` if the `concurrentRoot` function is enabled. In any other case, it returns `false`.
- (BOOL)concurrentRootEnabled
{
return true;
}
@finish
Working this on simulator additionally get the identical error, however it opens a recaptcha web page for which ends up in profitable sign-in. However on bodily system recapcha don’t open and auth/error is thrown.