Google Login from flutterfire_ui works only in Beta channel release, not in production release

Viewed 217

Clicking on "Sign in with Google" button has no effect.

Technical details:-

  • Firebase hosting is used

  • flutterfire_ui package is used (v0.3.0)

  • Added the appropriate Authorised JavaScript origins and Authorised redirect URIs at Google Cloud Platform -> APIs and Services -> Credentials

  • Added the Google web app Client ID in my Flutter app

  • In my Firebase hosting, I have a custom domain as well. Default domain is: my-app.firebaseapp.com and my custom domain is: my-custom.domain.co

  • Everything works fine with Beta release (flutter build web and then firebase hosting:channel:deploy my-test-release) - Google login works fine at my default domain, but not at my custom domain.

  • Added all the appropriate Authorised JavaScript origins and Authorised redirect URIs at Google Cloud Platform -> APIs and Services -> Credentials for both the domains: default and custom domains.

  • Flutter: Flutter 2.8.1 • channel stable • https://github.com/flutter/flutter.git Framework • revision 77d935af4d (3 weeks ago) • 2021-12-16 08:37:33 -0800 Engine • revision 890a5fca2e Tools • Dart 2.15.1

  • npm : 8.1.2

  • node: v16.13.1

  • MacOS: 12.1

  • Browsers: CHROME,SAFARI on desktop and mobile as well.

  • firebase: ^9.0.2 (in pubspec.yaml)

  • google_sign_in: ^5.2.1 (in pubspec.yaml)

  • firebase_auth: ^3.3.3 (in pubspec.yaml)

  • Implemented Auth screen as follows:

Widget build(BuildContext context) => StreamBuilder<User?>(
stream:  FirebaseAuth.instance.authStateChanges()
builder: (context, snapshot) {
        if (!snapshot.hasData) {
         return SignInScreen(
           showAuthActionSwitch: false,
           actions: [
             AuthStateChangeAction<SignedIn>((context, _) {
                  // whenever auth state changes to SignedIn 
                  // Do some operations and then navigate to some screen
                   Navigator.of(context).pushNamedAndRemoveUntil(
                   Routes.createChart, (Route<dynamic> route) => false);
             }),
           ]
            providerConfigs: const [
             GoogleProviderConfiguration(
               clientId:
                   'my-app-google-web-client-id.apps.googleusercontent.com',
             ),
           ],
         );
       } // end if
      
     return const MyHomePage(title: StringConstants.appTitle);
) 

Observation

  • Clicking on "Sign in with Google" has no effect

Expected behaviour

  • Clicking on "Sign in with Google" button should open a popup or a new tab in the browser, and user should be able to login with one of his Google account credentials.

Any help would be greatly appreciated. Thanks in advance.

0 Answers
Related