Google signin - not working in production

324

After Uploading to play store, Play store generate its own SH1 which we have to replace in second key in google console.

Go to google console>app signing> copy SH1 generate by console. Add that in google sign in console replace it from 2nd key.

Share:
324
SK7
Author by

SK7

Updated on December 26, 2022

Comments

  • SK7
    SK7 over 1 year

    Google sign in works when testing on the emulator and a real device, however, in production it doesn't work. I have added the SHA 1 key to my Firestore project.

    How would I fix this?

    Future<User> googleSignIn() async {
        try {
          GoogleSignInAccount googleSignInAccount = await Global.googleSignIn.signIn();
          GoogleSignInAuthentication googleAuth =
              await googleSignInAccount.authentication;
    
          final AuthCredential credential = GoogleAuthProvider.credential(
            accessToken: googleAuth.accessToken,
            idToken: googleAuth.idToken,
          );
          UserCredential result = await Global.fbAuth.signInWithCredential(credential);
          User user = result.user;
          updateUserData(user);
          return user;
        } catch (error) {
          print(error);
          return null;
        }
      }
    
            onPressed: () async {
            showDialogue(context);
              var user = await loginMethod();
              if (user != null) {
                hideProgressDialogue(context);
                Navigator.pushReplacementNamed(context, SharedStrings.userInfoPath);
             
    
    signingConfigs {
           release {
               keyAlias keystoreProperties['keyAlias']
               keyPassword keystoreProperties['keyPassword']
               storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
               storePassword keystoreProperties['storePassword']
           }
       }
    
           buildTypes {
           release {
               // TODO: Add your own signing config for the release build.
               // Signing with the debug keys for now,
               // so `flutter run --release` works.
               signingConfig signingConfigs.release
           }
    
  • Muhammad Arbaz Zafar
    Muhammad Arbaz Zafar almost 3 years
    ahmed bajwa you are super you solve my problem