Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[firebase_app_check]: Activate AppCheck in a Flutter Web App Crash Authentication #13518

Open
1 task done
famartinez80 opened this issue Oct 18, 2024 · 6 comments
Open
1 task done
Labels
Needs Attention This issue needs maintainer attention. platform: web Issues / PRs which are specifically for web. plugin: auth type: bug Something isn't working

Comments

@famartinez80
Copy link

famartinez80 commented Oct 18, 2024

Is there an existing issue for this?

  • I have searched the existing issues.

Which plugins are affected?

App Check, Auth

Which platforms are affected?

Web

Description

On https://firebase.google.com/docs/app-check/flutter/default-providers, explain how to activate AppCheck for a Flutter web app but once I add this code the web app start to crash in the firebase host, It does not matter if I add or remove the web provider the result is the same.

Reproducing the issue

  1. Activate AppCheck in the App
  2. Deploy to Firebase Hosting

Firebase Core version

3.6.0

Flutter Version

3.24.3

Relevant Log Output

client.ts:69 
 POST https://content-firebaseappcheck.googleapis.com/v1/projects/manifest-de57a/…3daab240d30:exchangeDebugToken?key=xxxxxxxxxxxxx 403 (Forbidden)

Uncaught Error: [firebase_auth/network-request-failed] A network AuthError (such as timeout, interrupted connection or unreachable host) has occurred.

Flutter dependencies

Expand Flutter dependencies snippet
flutter pub deps -- --style=compact
Dart SDK 3.5.3
Flutter SDK 3.24.3
manifest_app 1.0.0+3

dependencies:
- badges 3.1.2 [flutter]
- cached_network_image 3.4.1 [cached_network_image_platform_interface cached_network_image_web flutter flutter_cache_manager octo_image]
- cloud_firestore 5.4.4 [cloud_firestore_platform_interface cloud_firestore_web collection firebase_core firebase_core_platform_interface flutter meta]
- cloud_functions 5.1.3 [cloud_functions_platform_interface cloud_functions_web firebase_core firebase_core_platform_interface flutter]
- country_code_picker 3.0.0 [flutter collection]
- cupertino_icons 1.0.8
- currency_text_input_formatter 2.2.5 [flutter intl]
- firebase_analytics 11.3.3 [firebase_analytics_platform_interface firebase_analytics_web firebase_core firebase_core_platform_interface flutter]
- firebase_app_check 0.3.1+3 [firebase_app_check_platform_interface firebase_app_check_web firebase_core firebase_core_platform_interface flutter]
- firebase_auth 5.3.1 [firebase_auth_platform_interface firebase_auth_web firebase_core firebase_core_platform_interface flutter meta]
- firebase_core 3.6.0 [firebase_core_platform_interface firebase_core_web flutter meta]
- firebase_crashlytics 4.1.3 [firebase_core firebase_core_platform_interface firebase_crashlytics_platform_interface flutter stack_trace]
- firebase_messaging 15.1.3 [firebase_core firebase_core_platform_interface firebase_messaging_platform_interface firebase_messaging_web flutter meta]
- firebase_pagination 4.0.1 [cloud_firestore firebase_database flutter]
- firebase_remote_config 5.1.3 [firebase_core firebase_core_platform_interface firebase_remote_config_platform_interface firebase_remote_config_web flutter]
- firebase_storage 12.3.3 [firebase_core firebase_core_platform_interface firebase_storage_platform_interface firebase_storage_web flutter]
- flutter 0.0.0 [characters collection material_color_utilities meta vector_math sky_engine]
- flutter_expandable_fab 2.3.0 [flutter]
- flutter_local_notifications 17.2.3 [clock flutter flutter_local_notifications_linux flutter_local_notifications_platform_interface timezone]
- flutter_riverpod 2.5.3 [collection flutter meta riverpod state_notifier]
- flutter_timer_countdown 1.0.7 [flutter]
- internet_connection_checker_plus 2.5.2 [connectivity_plus flutter http]
- intl 0.19.0 [clock meta path]
- side_sheet 1.0.4 [flutter]
- transparent_image 2.0.1
- uuid 4.5.1 [crypto sprintf meta fixnum]

dev dependencies:
- flutter_launcher_icons 0.14.1 [args checked_yaml cli_util image json_annotation path yaml]
- 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]

transitive dependencies:
- _flutterfire_internals 1.3.44 [collection firebase_core firebase_core_platform_interface flutter meta]
- archive 3.6.1 [crypto path]
- args 2.6.0
- async 2.11.0 [collection meta]
- boolean_selector 2.1.1 [source_span string_scanner]
- cached_network_image_platform_interface 4.1.1 [flutter flutter_cache_manager]
- cached_network_image_web 1.3.1 [cached_network_image_platform_interface flutter flutter_cache_manager web]
- 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.4.3 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface]
- cloud_firestore_web 4.3.2 [_flutterfire_internals cloud_firestore_platform_interface collection firebase_core firebase_core_web flutter flutter_web_plugins]
- cloud_functions_platform_interface 5.5.37 [firebase_core flutter meta plugin_platform_interface]
- cloud_functions_web 4.10.2 [cloud_functions_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins]
- collection 1.18.0
- connectivity_plus 6.0.5 [flutter flutter_web_plugins connectivity_plus_platform_interface web meta nm collection]
- connectivity_plus_platform_interface 2.0.1 [flutter meta plugin_platform_interface]
- crypto 3.0.6 [typed_data]
- dbus 0.7.10 [args ffi meta xml]
- fake_async 1.3.1 [clock collection]
- ffi 2.1.3
- file 7.0.1 [meta path]
- firebase_analytics_platform_interface 4.2.5 [_flutterfire_internals firebase_core flutter meta plugin_platform_interface]
- firebase_analytics_web 0.5.10+2 [_flutterfire_internals firebase_analytics_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins]
- firebase_app_check_platform_interface 0.1.0+38 [_flutterfire_internals firebase_core flutter meta plugin_platform_interface]
- firebase_app_check_web 0.1.3+2 [_flutterfire_internals firebase_app_check_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins web]
- firebase_auth_platform_interface 7.4.7 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface]
- firebase_auth_web 5.13.2 [firebase_auth_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins http_parser meta web]
- firebase_core_platform_interface 5.3.0 [collection flutter flutter_test meta plugin_platform_interface]
- firebase_core_web 2.18.1 [firebase_core_platform_interface flutter flutter_web_plugins meta web]
- firebase_crashlytics_platform_interface 3.6.44 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface]
- firebase_database 11.1.4 [firebase_core firebase_core_platform_interface firebase_database_platform_interface firebase_database_web flutter]
- firebase_database_platform_interface 0.2.5+44 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface]
- firebase_database_web 0.2.6+2 [collection firebase_core firebase_core_web firebase_database_platform_interface flutter flutter_web_plugins]
- firebase_messaging_platform_interface 4.5.46 [_flutterfire_internals firebase_core flutter meta plugin_platform_interface]
- firebase_messaging_web 3.9.2 [_flutterfire_internals firebase_core firebase_core_web firebase_messaging_platform_interface flutter flutter_web_plugins meta web]
- firebase_remote_config_platform_interface 1.4.44 [_flutterfire_internals firebase_core flutter meta plugin_platform_interface]
- firebase_remote_config_web 1.7.2 [firebase_core firebase_core_web firebase_remote_config_platform_interface flutter flutter_web_plugins]
- firebase_storage_platform_interface 5.1.31 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface]
- firebase_storage_web 3.10.3 [_flutterfire_internals async firebase_core firebase_core_web firebase_storage_platform_interface flutter flutter_web_plugins http meta web]
- fixnum 1.1.1
- flutter_cache_manager 3.4.1 [clock collection file flutter http path path_provider rxdart sqflite uuid]
- flutter_local_notifications_linux 4.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_web_plugins 0.0.0 [flutter characters collection material_color_utilities meta vector_math]
- http 1.2.2 [async http_parser meta web]
- http_parser 4.0.2 [collection source_span string_scanner typed_data]
- image 4.3.0 [archive meta xml]
- json_annotation 4.9.0 [meta]
- leak_tracker 10.0.5 [clock collection meta path vm_service]
- leak_tracker_flutter_testing 3.0.5 [flutter leak_tracker leak_tracker_testing matcher meta]
- leak_tracker_testing 3.0.1 [leak_tracker matcher meta]
- matcher 0.12.16+1 [async meta stack_trace term_glyph test_api]
- material_color_utilities 0.11.1 [collection]
- meta 1.15.0
- nm 0.5.0 [dbus]
- octo_image 2.1.0 [flutter]
- path 1.9.0
- path_provider 2.1.4 [flutter path_provider_android path_provider_foundation path_provider_linux path_provider_platform_interface path_provider_windows]
- path_provider_android 2.2.12 [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.3.0 [ffi flutter path path_provider_platform_interface]
- petitparser 6.0.2 [meta]
- platform 3.1.5
- plugin_platform_interface 2.1.8 [meta]
- riverpod 2.5.3 [collection meta stack_trace state_notifier]
- rxdart 0.28.0
- sky_engine 0.0.99
- source_span 1.10.0 [collection path term_glyph]
- sprintf 7.0.0
- sqflite 2.4.0 [flutter sqflite_android sqflite_darwin sqflite_platform_interface sqflite_common path]
- sqflite_android 2.4.0 [flutter sqflite_common path sqflite_platform_interface]
- sqflite_common 2.5.4+5 [synchronized path meta]
- sqflite_darwin 2.4.1-1 [flutter sqflite_platform_interface meta sqflite_common path]
- sqflite_platform_interface 2.4.0 [flutter platform sqflite_common plugin_platform_interface meta]
- stack_trace 1.11.1 [path]
- state_notifier 1.0.0 [meta]
- stream_channel 2.1.2 [async]
- string_scanner 1.2.0 [source_span]
- synchronized 3.3.0+3
- term_glyph 1.2.1
- test_api 0.7.2 [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]
- vector_math 2.1.4
- vm_service 14.2.5
- web 1.1.0
- xdg_directories 1.1.0 [meta path]
- xml 6.5.0 [collection meta petitparser]
- yaml 3.1.2 [collection source_span string_scanner]

Additional context and comments

No response

@famartinez80 famartinez80 added Needs Attention This issue needs maintainer attention. type: bug Something isn't working labels Oct 18, 2024
@SelaseKay
Copy link
Contributor

I'm unable to reproduce this issue. Kindly provide a sample minimal code reproducing this issue. Additionally, it would be helpful if you could outline clear steps to reproduce the issue.

@SelaseKay SelaseKay added plugin: auth platform: web Issues / PRs which are specifically for web. blocked: customer-response Waiting for customer response, e.g. more information was requested. labels Oct 21, 2024
@famartinez80
Copy link
Author

Adding this code to the main.dart

await FirebaseAppCheck.instance.activate(
      webProvider: ReCaptchaV3Provider('xxxx'),
      androidProvider: kDebugMode ? AndroidProvider.debug : AndroidProvider.playIntegrity,
      appleProvider: AppleProvider.deviceCheck,
    );

Then deployed to Firebase hosting firebase deploy or firebase hosting:channel:deploy staging

@google-oss-bot google-oss-bot removed the blocked: customer-response Waiting for customer response, e.g. more information was requested. label Oct 21, 2024
@SelaseKay
Copy link
Contributor

Hi @famartinez80 , have you enabled App Check in your Firebase console?

@SelaseKay SelaseKay added the blocked: customer-response Waiting for customer response, e.g. more information was requested. label Oct 22, 2024
@famartinez80
Copy link
Author

Yes, I activate App Check in Firebase

image

I don't know if the problem is something related I activated reCAPTCHA and reCAPTCHA Enterprise but I don't know how to deactivate one.

@google-oss-bot google-oss-bot removed the blocked: customer-response Waiting for customer response, e.g. more information was requested. label Oct 22, 2024
@tamirrab
Copy link

tamirrab commented Nov 1, 2024

You can use only reCAPCHA
And you must to Enforced Authentication
Without Enforced Authentication you will not see the problem

image
@tamirrab
Copy link

tamirrab commented Nov 1, 2024

Also: on refresh you will still be logged in
But when you will close your browser - you will log out (Crash Authentication)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Attention This issue needs maintainer attention. platform: web Issues / PRs which are specifically for web. plugin: auth type: bug Something isn't working
4 participants