Skip to content

[firebase_app_check]: Firebase App Check is failing on Xiaomi devices #17106

@hasankarli

Description

@hasankarli

Is there an existing issue for this?

  • I have searched the existing issues.

Which plugins are affected?

App Check

Which platforms are affected?

Android

Description

Expected Behavior:
The FirebaseAppCheck.instance.activate() method should successfully activate App Check, and getToken() should return a valid token.

Actual Behavior:
The code fails to activate App Check or retrieve a valid token on Xiaomi devices, resulting in an error.

Error Details:
[firebase_app_check/unknown] ha.k: Error returned from API. code: 403 body: App attestation failed.

Additional Details:
Android and iOS works only xiaomi devices not working

Device:
Device: Xiaomi (Redmi Note 12S)
Android version: Android 13

Reproducing the issue

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Firebase.initializeApp();
  
  try {
    await FirebaseAppCheck.instance.activate(
      androidProvider: kDebugMode
          ? AndroidProvider.debug
          : AndroidProvider.playIntegrity,
      appleProvider: kDebugMode
          ? AppleProvider.debug
          : AppleProvider.appAttestWithDeviceCheckFallback,
    );
    final token = await FirebaseAppCheck.instance.getToken(true);
    print('App Check Token: $token');
  } catch (e) {
    print('Error: $e');
  }
  
  runApp(MyApp());
}

Firebase Core version

3.9.0

Flutter Version

3.24.0

Relevant Log Output

Flutter dependencies

Expand Flutter dependencies snippet
Replace this line with the contents of your `flutter pub deps -- --style=compact`.

Additional context and comments

The error seen in production environment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions