Open
Description
Issue
Looking at the AppCheck implementation in rnfirebase, it doesn't seem like it follows the docs provided in the rnfirebase.io.
Code snippet from docs is as follows:
import { ReactNativeFirebaseAppCheckProvider } from `@react-native-firebase/app-check`;
import { initializeAppCheck } from `@react-native-firebase/app-check`;
rnfbProvider = new ReactNativeFirebaseAppCheckProvider();
rnfbProvider.configure({
android: {
provider: __DEV__ ? 'debug' : 'playIntegrity',
debugToken: 'some token you have configured for your project firebase web console',
},
apple: {
provider: __DEV__ ? 'debug' : 'appAttestWithDeviceCheckFallback',
debugToken: 'some token you have configured for your project firebase web console',
},
web: {
provider: 'reCaptchaV3',
siteKey: 'unknown',
},
});
const appCheck = initializeAppCheck({ provider: rnfbProvider, isTokenAutoRefreshEnabled
However, most I could build (working!) with the rnfirebase API is as follows:
import { getApp } from "@react-native-firebase/app";
import getAppCheck, { getToken, initializeAppCheck } from "@react-native-firebase/app-check";
const app = getApp()
const appCheck = getAppCheck(app)
const provider = appCheck.newReactNativeFirebaseAppCheckProvider();
provider.configure({
android: {
provider: "debug",
},
apple: {
provider: "debug",
},
isTokenAutoRefreshEnabled: true,
});
await initializeAppCheck(app, {
provider,
});
const token = await getToken(appCheck, false);
if (token.token.length <= 0) {
throw new Error("AppCheck token was not initialized");
}
There are few issues I see:
initializeAppCheck
is ought to return anAppCheck
instance, but the signature shows anApp
instance instead. source:- There is no
getAppCheck
exported, but I assume this expected since we need to initialize it throughinitializeAppCheck
. right? - There is no exported
newReactNativeFirebaseAppCheckProvider()
orReactNativeFirebaseAppCheckProvider
. This is a problem because in order to initialize the appCheck I'd need the result of provider.configure, but currently I need the appCheck instance to get build the provider.
I maybe wrong in all above (and hence these are expected API), but these are observations I just had. Appreciate if I can get feedback whether assumptions above are correct or not.
Thanks.
Project Files
Javascript
Click To Expand
package.json
:
# N/A
firebase.json
for react-native-firebase v6:
# N/A
iOS
Click To Expand
ios/Podfile
:
- I'm not using Pods
- I'm using Pods and my Podfile looks like:
# N/A
AppDelegate.m
:
// N/A
Android
Click To Expand
Have you converted to AndroidX?
- my application is an AndroidX application?
- I am using
android/gradle.settings
jetifier=true
for Android compatibility? - I am using the NPM package
jetifier
for react-native compatibility?
android/build.gradle
:
// N/A
android/app/build.gradle
:
// N/A
android/settings.gradle
:
// N/A
MainApplication.java
:
// N/A
AndroidManifest.xml
:
<!-- N/A -->
Environment
Click To Expand
react-native info
output:
OUTPUT GOES HERE
- Platform that you're experiencing the issue on:
- iOS
- Android
- iOS but have not tested behavior on Android
- Android but have not tested behavior on iOS
- Both
react-native-firebase
version you're using that has this issue:e.g. 5.4.3
Firebase
module(s) you're using that has the issue:e.g. Instance ID
- Are you using
TypeScript
?Y/N
&VERSION
- 👉 Check out
React Native Firebase
andInvertase
on Twitter for updates on the library.