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:
- pub add firebase_app_check / pub get
- I added this lines before my runApp():
await FirebaseAppCheck.instance.activate(),
await FirebaseAppCheck.instance.setTokenAutoRefreshEnabled(true),
FirebaseAppCheck.instance.onTokenChange.listen((token) {
print(token);
}),
- 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?
CodePudding user response:
The problem was: It doesn't start on the emulator...
I tried it on my physical phone and it worked fine.