Closed ablbol closed 1 month ago
I'm not seeing any print in your demo code, what are you expecting to see?
Hi @Lyokone, I am expecting to see the App Check Token!! Why doesn't it get printed?
There is not print in the code you have provided, why would it get printed ?
Doesn't this code print the App Check Token for both Android and iOS devices? Am I missing something?
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
await FirebaseAppCheck.instance.activate(
androidProvider: AndroidProvider.debug,
appleProvider: AppleProvider.debug,
);
No, this will
print(await appCheck.getToken(true));
@Lyokone, in your code above, where did you get the variable "appCheck"? I am following instructions over here for iOS and Android and there no such variable. Please explain so that we can understand.
I am not using the line of code you pointed out and still getting the App Check taken in iOS. How is that possible?
I am still having this issue, I think what @ablbol meant was the debug token is not being printed, not the actual app check token. Could you reopen this issue @Lyokone ?
Correct, I was referring to the App Check "debug token". It does not print on Android devices 95% of the time.
@ablbol I'm excited to share I seem to have somewhat found a get-around for this issue. At least for my application: Although documentation hints at otherwise, providing any name for the firebase app during initialization will allow debug keys to be printed more consistently. An example from my code:
...
WidgetsFlutterBinding.ensureInitialized();
final app = await Firebase.initializeApp(
name: 'db2',
options: DefaultFirebaseOptions.currentPlatform,
);
print(app.name);
print(app.options.appId);
await FirebaseAppCheck.instanceFor(app: app).activate(
...
)
...
or without the print statements, and with a more standard .instance
...
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp(
name: 'db2',
options: DefaultFirebaseOptions.currentPlatform,
);
await FirebaseAppCheck.instance.activate(
...
)
...
The app.name
had a value of "[DEFAULT]", which could've possibly caused issues, a speculation. Look for this line:
D/com.google.firebase.appcheck.debug.internal.DebugAppCheckProvider(18512): Enter this debug secret into the allow list in the Firebase Console for your project: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
Let me know if you have any questions that might help with your application issue @ablbol . Or anything I can do to assist with the bug hunting @Lyokone .
Is there an existing issue for this?
Which plugins are affected?
App Check
Which platforms are affected?
Android
Description
I have been having this problem for many months. I really appreciate any help. I am using real Android device. I followed instructions carefully and unfortunately most of the time the App Check token does not print to the screen. Here is my Flutter code that should print the token:
I keep restarting my app on 3 different real Androide devices in the hope that an App Check token is printed, but I might get lucky and get a token after 24 hours of trying. This is very frustrating. Could someone please help.
Reproducing the issue
use the following command to run the Flutter app and wait for the App Check Token to be printed, but it never does:
Firebase Core version
^3.1.1
Flutter Version
3.22.2
Relevant Log Output
Flutter dependencies
Expand
Flutter dependencies
snippet```yaml flutter pub deps -- --style=compact Dart SDK 3.4.3 Flutter SDK 3.22.2 oolfa 1.5.3+58 dependencies: - android_id 0.4.0 [flutter] - audio_waveforms 1.0.5 [flutter] - audioplayers 6.0.0 [audioplayers_android audioplayers_darwin audioplayers_linux audioplayers_platform_interface audioplayers_web audioplayers_windows file flutter http meta path_provider synchronized uuid] - badges 3.1.2 [flutter] - cached_network_image 3.3.1 [cached_network_image_platform_interface cached_network_image_web flutter flutter_cache_manager octo_image] - carousel_slider 4.2.1 [flutter] - cloud_firestore 5.0.2 [cloud_firestore_platform_interface cloud_firestore_web collection firebase_core firebase_core_platform_interface flutter meta] - cloud_functions 5.0.2 [cloud_functions_platform_interface cloud_functions_web firebase_core firebase_core_platform_interface flutter] - connectivity_plus 6.0.3 [flutter flutter_web_plugins connectivity_plus_platform_interface web meta nm collection] - crypto 3.0.3 [typed_data] - cupertino_icons 1.0.8 - device_info_plus 10.1.0 [device_info_plus_platform_interface ffi file flutter flutter_web_plugins meta web win32 win32_registry] - dotted_border 2.1.0 [flutter path_drawing] - firebase_analytics 11.1.0 [firebase_analytics_platform_interface firebase_analytics_web firebase_core firebase_core_platform_interface flutter] - firebase_app_check 0.3.0+2 [firebase_app_check_platform_interface firebase_app_check_web firebase_core firebase_core_platform_interface flutter] - firebase_auth 5.1.1 [firebase_auth_platform_interface firebase_auth_web firebase_core firebase_core_platform_interface flutter meta] - firebase_core 3.1.1 [firebase_core_platform_interface firebase_core_web flutter meta] - firebase_crashlytics 4.0.2 [firebase_core firebase_core_platform_interface firebase_crashlytics_platform_interface flutter stack_trace] - firebase_database 11.0.2 [firebase_core firebase_core_platform_interface firebase_database_platform_interface firebase_database_web flutter] - firebase_messaging 15.0.2 [firebase_core firebase_core_platform_interface firebase_messaging_platform_interface firebase_messaging_web flutter meta] - firebase_remote_config 5.0.2 [firebase_core firebase_core_platform_interface firebase_remote_config_platform_interface firebase_remote_config_web flutter] - firebase_storage 12.1.0 [firebase_core firebase_core_platform_interface firebase_storage_platform_interface firebase_storage_web flutter] - firebase_ui_firestore 1.6.4 [cloud_firestore firebase_ui_localizations firebase_ui_shared flutter] - flash 3.1.1 [flutter] - flutter 0.0.0 [characters collection material_color_utilities meta vector_math sky_engine] - flutter_dotenv 5.1.0 [flutter] - flutter_facebook_auth 7.0.1 [flutter flutter_facebook_auth_platform_interface flutter_facebook_auth_web facebook_auth_desktop] - flutter_hooks 0.20.5 [flutter] - flutter_image_compress 2.3.0 [flutter flutter_image_compress_platform_interface flutter_image_compress_common flutter_image_compress_web flutter_image_compress_macos flutter_image_compress_ohos] - flutter_launcher_icons 0.13.1 [args checked_yaml cli_util image json_annotation path yaml] - flutter_local_notifications 17.2.1 [clock flutter flutter_local_notifications_linux flutter_local_notifications_platform_interface timezone] - flutter_localizations 0.0.0 [flutter intl characters clock collection material_color_utilities meta path vector_math] - flutter_slidable 3.1.0 [flutter] - flutter_svg 2.0.10+1 [flutter http vector_graphics vector_graphics_codec vector_graphics_compiler] - geocoding 3.0.0 [flutter geocoding_platform_interface geocoding_android geocoding_ios] - geolocator 12.0.0 [flutter geolocator_platform_interface geolocator_android geolocator_apple geolocator_web geolocator_windows] - go_router 14.2.0 [collection flutter flutter_web_plugins logging meta] - google_sign_in 6.2.1 [flutter google_sign_in_android google_sign_in_ios google_sign_in_platform_interface google_sign_in_web] - hooks_riverpod 2.5.1 [collection flutter flutter_hooks flutter_riverpod riverpod state_notifier] - http 1.2.1 [async http_parser meta web] - image_cropper 7.1.0 [flutter image_cropper_platform_interface image_cropper_for_web] - image_picker 1.1.2 [flutter image_picker_android image_picker_for_web image_picker_ios image_picker_linux image_picker_macos image_picker_platform_interface image_picker_windows] - intl 0.19.0 [clock meta path] - mask_text_input_formatter 2.9.0 [flutter] - material_design_icons_flutter 7.0.7296 [flutter] - open_mail_app 0.4.5 [platform url_launcher flutter] - package_info_plus 8.0.0 [ffi flutter flutter_web_plugins http meta path package_info_plus_platform_interface web win32 clock] - path 1.9.0 - path_provider 2.1.3 [flutter path_provider_android path_provider_foundation path_provider_linux path_provider_platform_interface path_provider_windows] - permission_handler 11.3.1 [flutter meta permission_handler_android permission_handler_apple permission_handler_html permission_handler_windows permission_handler_platform_interface] - photo_view 0.15.0 [flutter] - purchases_flutter 6.29.4 [flutter freezed_annotation json_annotation] - rate_my_app 2.2.0 [shared_preferences flutter_rating_bar flutter] - rxdart 0.27.7 - scrollable_positioned_list 0.3.8 [flutter collection] - share_plus 9.0.0 [cross_file meta mime flutter flutter_web_plugins share_plus_platform_interface file url_launcher_web url_launcher_windows url_launcher_linux url_launcher_platform_interface ffi web win32] - shared_preferences 2.2.3 [flutter shared_preferences_android shared_preferences_foundation shared_preferences_linux shared_preferences_platform_interface shared_preferences_web shared_preferences_windows] - shimmer 3.0.0 [flutter] - showcaseview 3.0.0 [flutter] - stack_trace 1.11.1 [path] - store_redirect 2.0.2 [flutter] - swipe_to 1.0.6 [flutter] - timeago 3.6.1 [intl] - url_launcher 6.3.0 [flutter url_launcher_android url_launcher_ios url_launcher_linux url_launcher_macos url_launcher_platform_interface url_launcher_web url_launcher_windows] - uuid 4.4.0 [crypto sprintf meta fixnum] - webview_flutter 4.8.0 [flutter webview_flutter_android webview_flutter_platform_interface webview_flutter_wkwebview] dev dependencies: - flutter_test 0.0.0 [flutter test_api matcher path fake_async clock stack_trace vector_math leak_tracker_flutter_testing async boolean_selector characters collection leak_tracker leak_tracker_testing material_color_utilities meta source_span stream_channel string_scanner term_glyph vm_service] - flutter_web_plugins 0.0.0 [flutter characters collection material_color_utilities meta vector_math] - mocktail 1.0.4 [collection matcher test_api] - very_good_analysis 6.0.0 transitive dependencies: - _flutterfire_internals 1.3.38 [collection firebase_core firebase_core_platform_interface flutter meta] - archive 3.6.1 [crypto path] - args 2.5.0 - async 2.11.0 [collection meta] - audioplayers_android 5.0.0 [audioplayers_platform_interface flutter] - audioplayers_darwin 6.0.0 [audioplayers_platform_interface flutter] - audioplayers_linux 4.0.0 [audioplayers_platform_interface flutter] - audioplayers_platform_interface 7.0.0 [collection flutter meta plugin_platform_interface] - audioplayers_web 5.0.0 [audioplayers_platform_interface flutter flutter_web_plugins web] - audioplayers_windows 4.0.0 [audioplayers_platform_interface flutter] - boolean_selector 2.1.1 [source_span string_scanner] - cached_network_image_platform_interface 4.0.0 [flutter flutter_cache_manager] - cached_network_image_web 1.2.0 [cached_network_image_platform_interface flutter flutter_cache_manager] - characters 1.3.0 - checked_yaml 2.0.3 [json_annotation source_span yaml] - cli_util 0.4.1 [meta path] - clock 1.1.1 - cloud_firestore_platform_interface 6.2.8 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface] - cloud_firestore_web 4.0.2 [_flutterfire_internals cloud_firestore_platform_interface collection firebase_core firebase_core_web flutter flutter_web_plugins] - cloud_functions_platform_interface 5.5.31 [firebase_core flutter meta plugin_platform_interface] - cloud_functions_web 4.9.9 [cloud_functions_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins] - collection 1.18.0 - connectivity_plus_platform_interface 2.0.0 [flutter meta plugin_platform_interface] - cross_file 0.3.4+1 [meta web] - dbus 0.7.10 [args ffi meta xml] - device_info_plus_platform_interface 7.0.0 [flutter meta plugin_platform_interface] - facebook_auth_desktop 2.0.0 [flutter http flutter_secure_storage flutter_facebook_auth_platform_interface] - fake_async 1.3.1 [clock collection] - ffi 2.1.2 - file 7.0.0 [meta path] - file_selector_linux 0.9.2+1 [cross_file file_selector_platform_interface flutter] - file_selector_macos 0.9.4 [cross_file file_selector_platform_interface flutter] - file_selector_platform_interface 2.6.2 [cross_file flutter http plugin_platform_interface] - file_selector_windows 0.9.3+1 [cross_file file_selector_platform_interface flutter] - firebase_analytics_platform_interface 4.1.0 [_flutterfire_internals firebase_core flutter meta plugin_platform_interface] - firebase_analytics_web 0.5.8 [_flutterfire_internals firebase_analytics_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins] - firebase_app_check_platform_interface 0.1.0+32 [_flutterfire_internals firebase_core flutter meta plugin_platform_interface] - firebase_app_check_web 0.1.2+10 [_flutterfire_internals firebase_app_check_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins web] - firebase_auth_platform_interface 7.4.1 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface] - firebase_auth_web 5.12.3 [firebase_auth_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins http_parser meta web] - firebase_core_platform_interface 5.1.0 [collection flutter flutter_test meta plugin_platform_interface] - firebase_core_web 2.17.2 [firebase_core_platform_interface flutter flutter_web_plugins meta web] - firebase_crashlytics_platform_interface 3.6.38 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface] - firebase_database_platform_interface 0.2.5+38 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface] - firebase_database_web 0.2.5+10 [collection firebase_core firebase_core_web firebase_database_platform_interface flutter flutter_web_plugins] - firebase_messaging_platform_interface 4.5.40 [_flutterfire_internals firebase_core flutter meta plugin_platform_interface] - firebase_messaging_web 3.8.10 [_flutterfire_internals firebase_core firebase_core_web firebase_messaging_platform_interface flutter flutter_web_plugins meta web] - firebase_remote_config_platform_interface 1.4.38 [_flutterfire_internals firebase_core flutter meta plugin_platform_interface] - firebase_remote_config_web 1.6.10 [firebase_core firebase_core_web firebase_remote_config_platform_interface flutter flutter_web_plugins] - firebase_storage_platform_interface 5.1.25 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface] - firebase_storage_web 3.9.10 [_flutterfire_internals async firebase_core firebase_core_web firebase_storage_platform_interface flutter flutter_web_plugins http meta web] - firebase_ui_localizations 1.12.0 [flutter flutter_localizations path] - firebase_ui_shared 1.4.1 [flutter] - fixnum 1.1.0 - flutter_cache_manager 3.3.1 [clock collection file flutter http path path_provider rxdart sqflite uuid] - flutter_facebook_auth_platform_interface 6.0.0 [flutter plugin_platform_interface] - flutter_facebook_auth_web 6.0.0 [flutter flutter_web_plugins js flutter_facebook_auth_platform_interface] - flutter_image_compress_common 1.0.5 [flutter flutter_image_compress_platform_interface] - flutter_image_compress_macos 1.0.2 [flutter flutter_image_compress_platform_interface] - flutter_image_compress_ohos 0.0.3 [flutter flutter_image_compress_platform_interface] - flutter_image_compress_platform_interface 1.0.5 [flutter plugin_platform_interface cross_file] - flutter_image_compress_web 0.1.4+1 [flutter flutter_web_plugins flutter_image_compress_platform_interface js] - flutter_local_notifications_linux 4.0.0+1 [dbus ffi flutter flutter_local_notifications_platform_interface path xdg_directories] - flutter_local_notifications_platform_interface 7.2.0 [flutter plugin_platform_interface] - flutter_plugin_android_lifecycle 2.0.20 [flutter] - flutter_rating_bar 4.0.1 [flutter] - flutter_riverpod 2.5.1 [collection flutter meta riverpod state_notifier] - flutter_secure_storage 9.2.2 [flutter flutter_secure_storage_linux flutter_secure_storage_macos flutter_secure_storage_platform_interface flutter_secure_storage_web flutter_secure_storage_windows meta] - flutter_secure_storage_linux 1.2.1 [flutter flutter_secure_storage_platform_interface] - flutter_secure_storage_macos 3.1.2 [flutter flutter_secure_storage_platform_interface] - flutter_secure_storage_platform_interface 1.1.2 [flutter plugin_platform_interface] - flutter_secure_storage_web 1.2.1 [flutter flutter_secure_storage_platform_interface flutter_web_plugins js] - flutter_secure_storage_windows 3.1.2 [ffi flutter flutter_secure_storage_platform_interface path path_provider win32] - freezed_annotation 2.4.1 [collection json_annotation meta] - geocoding_android 3.3.1 [flutter geocoding_platform_interface] - geocoding_ios 3.0.1 [flutter geocoding_platform_interface] - geocoding_platform_interface 3.2.0 [flutter meta plugin_platform_interface] - geolocator_android 4.6.0 [flutter geolocator_platform_interface meta uuid] - geolocator_apple 2.3.7 [flutter geolocator_platform_interface] - geolocator_platform_interface 4.2.4 [flutter plugin_platform_interface vector_math meta] - geolocator_web 4.0.0 [flutter flutter_web_plugins geolocator_platform_interface web] - geolocator_windows 0.2.3 [flutter geolocator_platform_interface] - google_identity_services_web 0.3.1+1 [meta web] - google_sign_in_android 6.1.26 [flutter google_sign_in_platform_interface] - google_sign_in_ios 5.7.6 [flutter google_sign_in_platform_interface] - google_sign_in_platform_interface 2.4.5 [flutter plugin_platform_interface] - google_sign_in_web 0.12.3+3 [flutter flutter_web_plugins google_identity_services_web google_sign_in_platform_interface http web] - http_parser 4.0.2 [collection source_span string_scanner typed_data] - image 4.2.0 [archive meta xml] - image_cropper_for_web 5.1.0 [flutter flutter_web_plugins image_cropper_platform_interface web] - image_cropper_platform_interface 6.1.0 [flutter plugin_platform_interface http] - image_picker_android 0.8.12+3 [flutter flutter_plugin_android_lifecycle image_picker_platform_interface] - image_picker_for_web 3.0.2 [flutter flutter_web_plugins image_picker_platform_interface mime] - image_picker_ios 0.8.12 [flutter image_picker_platform_interface] - image_picker_linux 0.2.1+1 [file_selector_linux file_selector_platform_interface flutter image_picker_platform_interface] - image_picker_macos 0.2.1+1 [file_selector_macos file_selector_platform_interface flutter image_picker_platform_interface] - image_picker_platform_interface 2.10.0 [cross_file flutter http plugin_platform_interface] - image_picker_windows 0.2.1+1 [file_selector_platform_interface file_selector_windows flutter image_picker_platform_interface] - js 0.6.7 [meta] - json_annotation 4.9.0 [meta] - leak_tracker 10.0.4 [clock collection meta path vm_service] - leak_tracker_flutter_testing 3.0.3 [flutter leak_tracker leak_tracker_testing matcher meta] - leak_tracker_testing 3.0.1 [leak_tracker matcher meta] - logging 1.2.0 - matcher 0.12.16+1 [async meta stack_trace term_glyph test_api] - material_color_utilities 0.8.0 [collection] - meta 1.12.0 - mime 1.0.5 - nm 0.5.0 [dbus] - octo_image 2.0.0 [flutter] - package_info_plus_platform_interface 3.0.0 [flutter meta plugin_platform_interface] - path_drawing 1.0.1 [vector_math meta path_parsing flutter] - path_parsing 1.0.1 [vector_math meta] - path_provider_android 2.2.6 [flutter path_provider_platform_interface] - path_provider_foundation 2.4.0 [flutter path_provider_platform_interface] - path_provider_linux 2.2.1 [ffi flutter path path_provider_platform_interface xdg_directories] - path_provider_platform_interface 2.1.2 [flutter platform plugin_platform_interface] - path_provider_windows 2.2.1 [ffi flutter path path_provider_platform_interface win32] - permission_handler_android 12.0.7 [flutter permission_handler_platform_interface] - permission_handler_apple 9.4.5 [flutter permission_handler_platform_interface] - permission_handler_html 0.1.1 [flutter flutter_web_plugins permission_handler_platform_interface] - permission_handler_platform_interface 4.2.1 [flutter meta plugin_platform_interface] - permission_handler_windows 0.2.1 [flutter permission_handler_platform_interface] - petitparser 6.0.2 [meta] - platform 3.1.5 - plugin_platform_interface 2.1.8 [meta] - riverpod 2.5.1 [collection meta stack_trace state_notifier] - share_plus_platform_interface 4.0.0 [cross_file flutter meta mime plugin_platform_interface path_provider uuid] - shared_preferences_android 2.2.3 [flutter shared_preferences_platform_interface] - shared_preferences_foundation 2.4.0 [flutter shared_preferences_platform_interface] - shared_preferences_linux 2.3.2 [file flutter path path_provider_linux path_provider_platform_interface shared_preferences_platform_interface] - shared_preferences_platform_interface 2.3.2 [flutter plugin_platform_interface] - shared_preferences_web 2.3.0 [flutter flutter_web_plugins shared_preferences_platform_interface web] - shared_preferences_windows 2.3.2 [file flutter path path_provider_platform_interface path_provider_windows shared_preferences_platform_interface] - sky_engine 0.0.99 - source_span 1.10.0 [collection path term_glyph] - sprintf 7.0.0 - sqflite 2.3.3+1 [flutter sqflite_common path] - sqflite_common 2.5.4 [synchronized path meta] - state_notifier 1.0.0 [meta] - stream_channel 2.1.2 [async] - string_scanner 1.2.0 [source_span] - synchronized 3.1.0+1 - term_glyph 1.2.1 - test_api 0.7.0 [async boolean_selector collection meta source_span stack_trace stream_channel string_scanner term_glyph] - timezone 0.9.4 [path] - typed_data 1.3.2 [collection] - url_launcher_android 6.3.3 [flutter url_launcher_platform_interface] - url_launcher_ios 6.3.0 [flutter url_launcher_platform_interface] - url_launcher_linux 3.1.1 [flutter url_launcher_platform_interface] - url_launcher_macos 3.2.0 [flutter url_launcher_platform_interface] - url_launcher_platform_interface 2.3.2 [flutter plugin_platform_interface] - url_launcher_web 2.3.1 [flutter flutter_web_plugins url_launcher_platform_interface web] - url_launcher_windows 3.1.1 [flutter url_launcher_platform_interface] - vector_graphics 1.1.11+1 [flutter http vector_graphics_codec] - vector_graphics_codec 1.1.11+1 - vector_graphics_compiler 1.1.11+1 [args meta path_parsing xml vector_graphics_codec path] - vector_math 2.1.4 - vm_service 14.2.1 - web 0.5.1 - webview_flutter_android 3.16.4 [flutter webview_flutter_platform_interface] - webview_flutter_platform_interface 2.10.0 [flutter meta plugin_platform_interface] - webview_flutter_wkwebview 3.13.1 [flutter path webview_flutter_platform_interface] - win32 5.5.1 [ffi] - win32_registry 1.1.3 [ffi win32] - xdg_directories 1.0.4 [meta path] - xml 6.5.0 [collection meta petitparser] - yaml 3.1.2 [collection source_span string_scanner] ```
Additional context and comments
No response