admin管理员组

文章数量:1394585

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)

  1. Updated app.json config plugin with @react-native-firebase/app-check
  2. 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()
  }, [])
  1. AppCheck initialized was logged once I run the build.

B)

  1. Updated app.json config plugin with @react-native-firebase/app-check
  2. 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 ?

本文标签: