Skip to main content
  1. Posts/

Flutter and Firebase App Check - How to get the Debug Token with Android Simulator

·206 words·1 min
Programming Firebase Flutter
Nibble Cid
Author
Nibble Cid

Firebase App Check is an extra layer of security which protects access to your services by getting sure that the incoming traffic is indeed coming from your app. Unlike Firebase Authentication which provides user authentication protecting the users, App Check provide attestation of the app or device authenticity, protecting the platform and the developer/admin.

Working with Debug Tokens on Android Simulator
#

Firebase offers a way to test AppCheck on your apps by using debug tokens. You can read the guide for Flutter projects here! However, on the android case, there is a missing step on the guide which will grant you the debug token on the android simulator. Yes, you first need to update your main.dart file in your Flutter project and set the corresponding “androidProvider” to “debug” like this:

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Firebase.initializeApp();
  await FirebaseAppCheck.instance.activate(
    androidProvider: AndroidProvider.debug,
  );
  runApp(App());
}

But the token won’t be printed in the output of the running instance (where you can check for flutter errors and log messages). It will be printed in the LogCat section of your project in Android Studio:

Android Simulator Screenshot
With this token, you can successfully continue the guide adding the token in the “Debug Token” section of the AppCheck Configuration in Firebase.

Cheers!


comments powered by Disqus