Google signin - not working in production

╄→гoц情女王★ 提交于 2021-01-24 07:22:09

问题


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
       }

回答1:


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.



来源:https://stackoverflow.com/questions/65358177/google-signin-not-working-in-production

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!