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 authentication google sign in not working when I run my flutter web app in wasm mode, it is working fine in html and canvas kit renderer #17147

Open
vrajkishore opened this issue Feb 27, 2025 · 1 comment
Labels
blocked: customer-response Waiting for customer response, e.g. more information was requested. platform: web Issues / PRs which are specifically for web. plugin: auth type: bug Something isn't working

Comments

@vrajkishore
Copy link

I am listening to authstate changes using the listenToUserChanges() function and performing google sign in using the createGoogleAuthCustomer() function, in normal rendered I am able to listen to the FirebaseAuth.instance.authStateChanges() when I perform the google sign in a popup, in wasm even though I continue with google sign in the popup not able to listen to the FirebaseAuth.instance.authStateChanges() and also not able to find the error

import 'package:firebase_auth/firebase_auth.dart';

Stream<User?> listenToUserChanges() async* {
await for (var user in FirebaseAuth.instance.authStateChanges()) {
yield user;
}
}

Future createGoogleAuthCustomer() async {
try {
GoogleAuthProvider googleProvider = GoogleAuthProvider();
// googleProvider
// .addScope('https://www.googleapis.com/auth/contacts.readonly');
// googleProvider.setCustomParameters({'login_hint': '[email protected]'});
return await FirebaseAuth.instance.signInWithPopup(googleProvider);

} catch (e) {
  throw CustomException(AuthDataRepository, "Authentication failed",
      displayMessage: "Failed to authenticate with Google.");
}

}

Flutter Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.29.0, on macOS 15.3.1 24D70 darwin-x64, locale en-IN)
[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 16.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2023.1)
[✓] VS Code (version 1.97.2)
[✓] Connected device (2 available)
[✓] Network resources

• No issues found!

pubspec.yaml

firebase_core: ^3.12.1
firebase_auth: ^5.5.1

@MichaelVerdon MichaelVerdon added type: bug Something isn't working platform: web Issues / PRs which are specifically for web. Needs Attention This issue needs maintainer attention. plugin: auth labels Feb 27, 2025
@MichaelVerdon
Copy link
Contributor

Hi there, I tested out google sign in on our example authentication app in wasm mode and it worked perfectly fine and successfully checked persisted user data. I would suggest checking out how we implemented it here as maybe there is an issue with your implementation: https://github.com/firebase/flutterfire/tree/main/packages/firebase_auth/firebase_auth/example

@MichaelVerdon MichaelVerdon added blocked: customer-response Waiting for customer response, e.g. more information was requested. and removed Needs Attention This issue needs maintainer attention. labels Feb 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked: customer-response Waiting for customer response, e.g. more information was requested. platform: web Issues / PRs which are specifically for web. plugin: auth type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants