Flutter Google 登录问题(PlatformException(sign_in_failed, e5.b: 10:, null, null)

问题描述 投票:0回答:2

这是我收到的错误消息,每当我尝试使用谷歌登录时(此问题不会发生在应用程序的调试、发布和配置文件版本中。它只发生在我上传到的版本(aab)谷歌游戏商店):

PlatformException(sign_in_failed,e5.b:10:,null,null)

这是我的 pubspec.yaml 文件中与 google 相关的所有内容:

 google_mobile_ads: ^3.0.0
 google_sign_in: ^6.1.1
 google_sign_in_dartio: ^0.2.2+1
 googleapis: ^10.1.0
 firebase_core: ^2.13.0
 firebase_messaging: ^14.6.5

这些是我用来实现谷歌登录到我的应用程序的代码:

API CALL:

class ThirdPartyService extends AppService {
  static ThirdPartyService get instance => ThirdPartyService();

  ThirdPartyService() : super(path: '');

  static final googleSignInInstance = GoogleSignIn(
    serverClientId:
        'MY_CLIENT_ID',
  );

  Future signInWithGoogle() async {
    final gUser = googleSignInInstance.currentUser ?? await googleSignInInstance.signIn();
    if (gUser != null) {
      final gAuthEmail = gUser.email;
      final token = (await gUser.authentication).accessToken;
      var response = await post('/OAUTH/GOOGLE', {
        "EMAIL_ADDRESS": gAuthEmail,
        "TOKEN": token,
      });
      if (!response.success) throw response.message;
      return AppData.userDetail.value = {...response.data};
    }
    throw 'GoogleSignInFailed';
  }
}

------------------

GOOGLE SIGN IN FUNCTION:

void loginWithGoogle() async {
    try {
      await ThirdPartyService.instance.signInWithGoogle();
      Get.offAll(
        () => RateAppInitWidget(
          builder: (rateMyApp) => BottomNavBar(rateMyApp: rateMyApp),
        ),
      );
    } catch (e) {
      Get.snackbar(
        'Warning',
        'Google Sign in failed. Try again later.',
        colorText: AppColors.black,
        backgroundColor: AppColors.white,
        duration: const Duration(seconds: 5),
      );
    }
  }

如何解决这个问题?请帮忙😓

P.S:我的应用程序已获得谷歌的批准和验证,我已经尝试了许多与 SHA1 密钥相关的解决方案。

您好,我已经遵循了在我的应用程序中实现 google 登录的每一步(firebase 步骤、google 控制台、应用程序配置等)。即使谷歌登录在调试、发布和配置文件版本中正常工作。当我将 aab 上传到 google playstore 时它不起作用。我搜索了许多解决方案,并且确实尝试了我能找到的大多数(如果不是所有)修复,但问题仍然存在。

android flutter firebase google-cloud-platform google-signin
2个回答
0
投票

您需要为生产设置不同的 SHA-1 密钥,并且要能够做到这一点,您应该阅读本文

https://medium.com/@hamza.azee91/google-sign-in-into-your-android-app-step-by-step-57550e6e9398

您将看到有关如何使用 google cloud API 控制台以及 firebase 控制台的指南。


0
投票

我面临着同样的问题,尝试了上面提到的一切。问题仍然没有得到解决,奇怪的是,google登录IOS设备上完美运行,我只面临的问题是在ANDROID设备上。

© www.soinside.com 2019 - 2024. All rights reserved.