Skip to content

Enable App Check

Firebase App Check is a mandatory security step before releasing your app. It helps protect your Firebase resources from abuse by verifying that incoming requests are from your authentic apps.

Setup in Firebase Console

  1. Go to Firebase Console > App Check

  2. Enable App Check for each provider:

    • Android: Play Integrity
    • iOS: Device Check/App Attest
    • Web: reCAPTCHA Enterprise
  3. Enable App Check enforcement for each service:

    • Realtime Database
    • Cloud Storage
    • Cloud Functions
    • Cloud Firestore

Platform Setup

Each platform requires specific setup in the Firebase Console. Follow the official documentation for detailed steps:

  1. Review Android App Check documentation

  2. Enable Play Integrity API:

  3. No code changes needed - Play Integrity is configured automatically

Implementation

ShipFlutter automatically initializes App Check with the appropriate provider:

await FirebaseAppCheck.instance.activate(
// Web: reCAPTCHA Enterprise
webProvider: ReCaptchaEnterpriseProvider(Env.keyRecaptcha),
// Android: Play Integrity or Debug Provider
androidProvider: kDebugMode
? AndroidProvider.debug
: AndroidProvider.playIntegrity,
// iOS: Device Check/App Attest or Debug Provider
appleProvider: kDebugMode
? AppleProvider.debug
: AppleProvider.appAttestWithDeviceCheckFallback,
);

Debug Tokens

During development, you’ll need debug tokens to run your app in emulators or CI environments. ShipFlutter automatically handles this by using debug providers in development mode but you’ll need to set them up for each platform (official docs).

  1. Enable debug logging in Xcode:

    • Open Product > Scheme > Edit scheme
    • Select Run > Arguments
    • Add -FIRDebugEnabled to Arguments Passed on Launch
  2. Run your app in Simulator

    Firebase App Check Debug Token:
    123a4567-b89c-12d3-e456-789012345678
  3. Register token in Firebase Console:

    • Go to App Check
    • Select your app’s overflow menu
    • Choose “Manage debug tokens”
    • Add the token

Debugging

If you encounter issues:

  1. Check the App Check Status in Firebase Console

  2. Verify debug provider is working in development:

    if (kDebugMode) {
    print('Using App Check debug provider');
    }
  3. Test with enforcement disabled first:

    • Disable enforcement in Firebase Console
    • Test your app thoroughly
    • Enable enforcement gradually per service
  4. Monitor App Check metrics in Firebase Console:

    • Token requests
    • Verification success rate
    • Error rates