firebase / flutterfire

🔥 A collection of Firebase plugins for Flutter apps.
https://firebase.google.com/docs/flutter/setup
BSD 3-Clause "New" or "Revised" License
8.61k stars 3.95k forks source link

[firebase_auth]: Flutter web release mode got this error when performing `signInWithPopup` : "UnImplementedError: signInWithPopup is only supported on web based platforms Flutter" #13184

Closed jonathandarwin closed 1 week ago

jonathandarwin commented 4 weeks ago

Is there an existing issue for this?

Which plugins are affected?

Auth

Which platforms are affected?

Web

Description

Flutter web release mode got this error when performing "signInWithPopup" (from firebase_auth & google_sign_in) : "UnImplementedError: signInWithPopup is only supported on web based platforms Flutter"

And here are some facts that i found:

Reproducing the issue

Perform sign-in via google in the web on release mode (flutter build web --release)

Firebase Core version

3.3.0

Flutter Version

3.22.2

Relevant Log Output

UnImplementedError: signInWithPopup is only supported on web based platforms Flutter

Flutter dependencies

Expand Flutter dependencies snippet
```yaml Dart SDK 3.4.3 Flutter SDK 3.22.2 project_name 1.0.0+1 dependencies: - cloud_firestore 5.2.1 [cloud_firestore_platform_interface cloud_firestore_web collection firebase_core firebase_core_platform_interface flutter meta] - cupertino_icons 1.0.8 - file_picker 8.0.7 [flutter flutter_web_plugins flutter_plugin_android_lifecycle plugin_platform_interface ffi path win32 cross_file web] - firebase_auth 5.1.4 [firebase_auth_platform_interface firebase_auth_web firebase_core firebase_core_platform_interface flutter meta] - firebase_core 3.3.0 [firebase_core_platform_interface firebase_core_web flutter meta] - firebase_storage 12.1.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_signin_button 2.0.0 [flutter font_awesome_flutter] - get 4.6.6 [flutter] - google_sign_in 6.2.1 [flutter google_sign_in_android google_sign_in_ios google_sign_in_platform_interface google_sign_in_web] - mime 1.0.5 - 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] - url_strategy 0.2.0 [flutter_web_plugins] dev dependencies: - flutter_lints 3.0.2 [lints] - 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.40 [collection firebase_core firebase_core_platform_interface flutter meta] - async 2.11.0 [collection meta] - boolean_selector 2.1.1 [source_span string_scanner] - characters 1.3.0 - clock 1.1.1 - cloud_firestore_platform_interface 6.3.1 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface] - cloud_firestore_web 4.1.1 [_flutterfire_internals cloud_firestore_platform_interface collection firebase_core firebase_core_web flutter flutter_web_plugins] - collection 1.18.0 - cross_file 0.3.4+2 [meta web] - fake_async 1.3.1 [clock collection] - ffi 2.1.2 - firebase_auth_platform_interface 7.4.3 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface] - firebase_auth_web 5.12.5 [firebase_auth_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins http_parser meta web] - firebase_core_platform_interface 5.2.0 [collection flutter flutter_test meta plugin_platform_interface] - firebase_core_web 2.17.4 [firebase_core_platform_interface flutter flutter_web_plugins meta web] - firebase_storage_platform_interface 5.1.27 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface] - firebase_storage_web 3.9.12 [_flutterfire_internals async firebase_core firebase_core_web firebase_storage_platform_interface flutter flutter_web_plugins http meta web] - flutter_plugin_android_lifecycle 2.0.21 [flutter] - flutter_web_plugins 0.0.0 [flutter characters collection material_color_utilities meta vector_math] - font_awesome_flutter 9.2.0 [flutter] - google_identity_services_web 0.3.1+4 [meta web] - google_sign_in_android 6.1.28 [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.4+2 [flutter flutter_web_plugins google_identity_services_web google_sign_in_platform_interface http web] - http 1.2.2 [async http_parser meta web] - http_parser 4.0.2 [collection source_span string_scanner typed_data] - 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] - lints 3.0.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 - path 1.9.0 - plugin_platform_interface 2.1.8 [meta] - sky_engine 0.0.99 - source_span 1.10.0 [collection path term_glyph] - stack_trace 1.11.1 [path] - stream_channel 2.1.2 [async] - string_scanner 1.2.0 [source_span] - 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] - typed_data 1.3.2 [collection] - url_launcher_android 6.3.8 [flutter url_launcher_platform_interface] - url_launcher_ios 6.3.1 [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.2 [flutter flutter_web_plugins url_launcher_platform_interface web] - url_launcher_windows 3.1.2 [flutter url_launcher_platform_interface] - vector_math 2.1.4 - vm_service 14.2.1 - web 0.5.1 - win32 5.5.3 [ffi] ```

Additional context and comments

Here is the code sample:

FirebaseAuth auth = FirebaseAuth.instance;

if(kIsWeb) {
  GoogleAuthProvider authProvider = GoogleAuthProvider();
  authProvider.setCustomParameters({
    "prompt" : "select_account"
  });

  try {
    final UserCredential userCredential = await auth.signInWithPopup(authProvider);
    UserCredential? user = userCredential.user;
  } catch (e) {

  }
}
SelaseKay commented 4 weeks ago

Hi @jonathandarwin . I'm unable to reproduce this issue on my end. Can you provide a full sample repo reproducing this experience?

google-oss-bot commented 2 weeks ago

Hey @jonathandarwin. We need more information to resolve this issue but there hasn't been an update in 7 weekdays. I'm marking the issue as stale and if there are no new updates in the next 7 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

google-oss-bot commented 1 week ago

Since there haven't been any recent updates here, I am going to close this issue.

@jonathandarwin if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.