0

I'm trying to set up my App Check for my Android App with this guide: https://firebase.flutter.dev/docs/app-check/usage/

Somehow I can't add the DebugMode because the Mainactivity instruction is too unclear for me. I created an "onCreate" function into this MainActivity.java . The App could not even start. This is the file before I added all the lines like in the instruction:

package com.company.appname;

import io.flutter.embedding.android.FlutterActivity;

public class MainActivity extends FlutterActivity {
}

Anyway, so I decided to go for the normal way:

  1. pub add firebase_app_check / pub get
  2. I added this lines before my runApp():
await FirebaseAppCheck.instance.activate(),
await FirebaseAppCheck.instance.setTokenAutoRefreshEnabled(true),
FirebaseAppCheck.instance.onTokenChange.listen((token) {
        print(token);
      }),
  1. Took my SHA256 Key (debug) from my gradle signingreport and set it to my App Check in Firebase

Now I call a function from my App and get these results:

From my App:

W/FirebaseContextProvider(17912): Error getting App Check token. Error: com.google.firebase.FirebaseException: Too many attempts.

And from the firebase functions console:

Callable request verification passed {"verifications":{"auth":"VALID","app":"MISSING"}}

At this point I don't even know what to do next. Even if I can set up the DebugMode. When the app goes for production I will have the same errors right?

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441
ShUtDoWn
  • 75
  • 2
  • 7
  • 1
    Can you post the error stack trace of the error message you are getting? Meanwhile can you check [this document](https://firebase.google.com/docs/app-check/android/safetynet-provider) which details steps for enabling app check in Android? – Prabir Feb 19 '22 at 12:50
  • I did have the emulator working with App Check in enforcement mode. Then as I was preparing to deploy my app, it stopped, and now gives the 'Missing or insufficient permissions' message. It still works on a physical Android device. I'm trying to work out what changed. – Luke Aug 01 '22 at 09:01

1 Answers1

1

Had the problem again...

It has to be on a physical phone. But this time a flutter clean helped.

ShUtDoWn
  • 75
  • 2
  • 7