GithubHelp home page GithubHelp logo

Comments (14)

Rexios80 avatar Rexios80 commented on June 17, 2024 1

The initializeApp call doesn't even work on Flutter stable, and that code has the same issue on Flutter master. Are you sure you ran with WASM using the instructions here: https://docs.flutter.dev/platform-integration/web/wasm#serving-wasm-locally

Or if you are on Flutter master you can run with flutter run -d chrome --wasm

from flutterfire.

Lyokone avatar Lyokone commented on June 17, 2024 1

Thanks @Rexios80 for your patience, finally reproduced on my end. I was using serve which doesn't seem to serve directly WASM instead of dhttpd.

from flutterfire.

Rexios80 avatar Rexios80 commented on June 17, 2024 1

Thanks for looking into it. Flutter WASM definitely has growing pains. I just want to raise awareness of the issues.

from flutterfire.

cynthiajoan avatar cynthiajoan commented on June 17, 2024

FYI @Rexios80 I marked away your apiKey, please be mindful while posting those in the issues.

from flutterfire.

Rexios80 avatar Rexios80 commented on June 17, 2024

Meh they're basically public information, I have it heavily restricted, and I have App Check enabled but thanks for looking out for me

from flutterfire.

Lyokone avatar Lyokone commented on June 17, 2024

Hello @Rexios80, I was wondering which commands you are using to get this issue, does it only happen using emulator? I don't see Google Sign In in your dependencies, are you using another way to complete Google OAuth?

from flutterfire.

Rexios80 avatar Rexios80 commented on June 17, 2024
await FirebaseAuth.instance.signInWithPopup(GoogleAuthProvider());

This happens on a deployed site as well as the emulator. Here is a deployed version of my site with the issue: https://beta.pubstats.dev (make sure to run in chrome or it might not actually be WASM)

The repo for that site is here: https://github.com/Rexios80/pub_stats
Here is the line: https://github.com/Rexios80/pub_stats/blob/bedf51898154e9fe9f63c9dd61db59a049184f72/pub_stats/lib/controller/user_controller.dart#L29

from flutterfire.

Lyokone avatar Lyokone commented on June 17, 2024

Thanks, I'll have another look with what you provided

from flutterfire.

Lyokone avatar Lyokone commented on June 17, 2024

@Rexios80 I've tried with this example

import 'package:firebase_auth/firebase_auth.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/material.dart';

void main() async {
 WidgetsFlutterBinding.ensureInitialized();
 await Firebase.initializeApp(
     options: const FirebaseOptions(
   apiKey: 'AIzaSyB7wZb2tO1-Fs6GbDADUSTs2Qs3w08Hovw',
   appId: '1:406099696497:web:87e25e51afe982cd3574d0',
   messagingSenderId: '406099696497',
   projectId: 'flutterfire-e2e-tests',
   authDomain: 'flutterfire-e2e-tests.firebaseapp.com',
   databaseURL:
       'https://flutterfire-e2e-tests-default-rtdb.europe-west1.firebasedatabase.app',
   storageBucket: 'flutterfire-e2e-tests.appspot.com',
   measurementId: 'G-JN95N1JV2E',
 ));
 runApp(const MyApp());
}

class MyApp extends StatelessWidget {
 const MyApp({super.key});

 @override
 Widget build(BuildContext context) {
   return MaterialApp(
     title: 'Google Sign In Demo',
     theme: ThemeData(
       primarySwatch: Colors.blue,
     ),
     home: const SignInDemo(),
   );
 }
}

class SignInDemo extends StatefulWidget {
 const SignInDemo({super.key});

 @override
 _SignInDemoState createState() => _SignInDemoState();
}

class _SignInDemoState extends State<SignInDemo> {
 User? _user;

 Future<void> _signInWithGoogle() async {
   final data =
       await FirebaseAuth.instance.signInWithPopup(GoogleAuthProvider());
   print(data);
 }

 Future<void> _signOut() async {
   await FirebaseAuth.instance.signOut();
   setState(() {
     _user = null;
   });
 }

 @override
 Widget build(BuildContext context) {
   return Scaffold(
     appBar: AppBar(
       title: const Text('Google Sign In Demo'),
     ),
     body: Center(
       child: _user == null
           ? ElevatedButton(
               onPressed: _signInWithGoogle,
               child: const Text('Sign in with Google'),
             )
           : Column(
               mainAxisAlignment: MainAxisAlignment.center,
               children: [
                 Text('Signed in as ${_user?.displayName}'),
                 ElevatedButton(
                   onPressed: _signOut,
                   child: const Text('Sign out'),
                 ),
               ],
             ),
     ),
   );
 }
}

And I was able to complete the Sign In successfully 🤔 Can you try with my example?

from flutterfire.

Lyokone avatar Lyokone commented on June 17, 2024

Yes

Flutter is already up to date on channel stable
Flutter 3.22.1 • channel stable • https://github.com/flutter/flutter.git
Framework • revision a14f74ff3a (6 days ago) • 2024-05-22 11:08:21 -0500
Engine • revision 55eae6864b
Tools • Dart 3.4.1 • DevTools 2.34.3
flutter build web --wasm
serve build/web

If you say the initializeApp don't work on stable, you probably have an issue with your setup.

from flutterfire.

ekasetiawans avatar ekasetiawans commented on June 17, 2024

I also facing the issue with latest flutter stable

from flutterfire.

Rexios80 avatar Rexios80 commented on June 17, 2024

I'm not sure what exactly could be wrong with my setup

Can you confirm that bool.fromEnvironment('FLUTTER_WEB_USE_SKWASM') is true?

from flutterfire.

Rexios80 avatar Rexios80 commented on June 17, 2024

The initializeApp issue is probably the same as #12623 which I'm not sure has landed in stable

from flutterfire.

Lyokone avatar Lyokone commented on June 17, 2024

I've tried a couple of things, even tried the official google_sign_in package. It wouldn't even render the button to sign in in web 🤔 Not sure how to help you with this issue, I'll raise it internally.

from flutterfire.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.