I'm trying to configure debug token for my debug build. As official rnfirebase docs seems not to be up to date, I am not able to figure out what I'm missing here.
After I enabled App Check from Firebase console, I generated debug token for android app and enforced request validation for Firestore so my previously installed apps failed loading the data. All fine.
Then I initialized app check for new debug build, expecting that requests going to firebase sdk's will have token properly set up.
When I run new debug build firebase error appears: 'FirebaseError: Missing or insufficient permissions'
Two approaches I tried:
A)
- Updated app.json config plugin with @react-native-firebase/app-check
- Updated App.tsx with:
import { getToken, initializeAppCheck, ReactNativeFirebaseAppCheckProvider } from "@react-native-firebase/app-check";
import { getApp } from '@react-native-firebase/app';
useEffect(() => {
const registerAppCheck = async () => {
try {
let rnfbProvider = new ReactNativeFirebaseAppCheckProvider();
rnfbProvider.configure({
android: {
provider: 'debug',
debugToken: 'MY ANDROID DEBUG TOKEN',
}
});
await initializeAppCheck(getApp(), { provider: rnfbProvider, isTokenAutoRefreshEnabled: true });
console.log('AppCheck initialized')
} catch (error) {
console.log('AppCheck initialization failed');
}
}
registerAppCheck()
}, [])
- AppCheck initialized was logged once I run the build.
B)
- Updated app.json config plugin with @react-native-firebase/app-check
- Updated eas.json like this:
"build": {
"development": {
"developmentClient": true,
"distribution": "internal",
"android": {
"buildType": "apk"
},
"env": {
"FIREBASE_APP_CHECK_DEBUG_TOKEN": "MY ANDROID DEBUG TOKEN"
}
},
...
Am I missing something important here ?