2

I am trying to run a callable cloud function on the emulator but I'm failing because the app check is not successful

Here's the launcher activity of my app. The activity calling the function is different.

super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_splash_screen);

        Objects.requireNonNull(getSupportActionBar()).hide();

        FirebaseApp.initializeApp(this);
        FirebaseAppCheck firebaseAppCheck = FirebaseAppCheck.getInstance();
        firebaseAppCheck.installAppCheckProviderFactory(SafetyNetAppCheckProviderFactory.getInstance());

The error I'm getting is:

W/FirebaseContextProvider: Error getting App Check token; using placeholder token instead.
Error: com.google.firebase.FirebaseException: Error returned from API. code: 403 body: App attestation failed: 1:<number>:android<number>:

I don't get how I should be initialising App Check instead.

Electric Dragon
  • 176
  • 5
  • 17

1 Answers1

0

SafetyNet Attestation fails in flutter because access to your Firebase resources without a valid device is not possible.

There is this wonderful guide to set this up in FlutterFire do check https://firebase.flutter.dev/docs/app-check/usage/

epynic
  • 1,124
  • 2
  • 14
  • 26
  • 2
    This works...i also found it in the Firebase [documentation](https://firebase.google.com/docs/app-check/android-debug-provider) – Electric Dragon Jun 24 '21 at 16:16
  • 2
    I'm getting the same error on a real device and have followed the official guideline. Do you have any ideas on what can I do to fix it? – Maciej Caputa Aug 03 '21 at 11:54
  • That guide worked for me, flutter clean ? – epynic Aug 03 '21 at 12:44
  • Link broken, please update or describe what the guide says in the answer. Also SafetyNet is deprecated and cannot be used on new projects. Play Integrity is required – IIRed-DeathII Jun 08 '23 at 07:31