Flutter google_sign_in 7.2.0版本GoogleSignInException(UNKNOWN_ERROR [28444]):开发者控制台配置错误排查求助
Flutter google_sign_in 7.2.0版本GoogleSignInException(UNKNOWN_ERROR [28444]):开发者控制台配置错误排查求助
各位大佬好,我最近在Flutter项目里用google_sign_in: ^7.2.0做Google登录时卡壳了,连续两天折腾都没搞定这个报错,实在没办法来求助了😭
错误详情
当我选择Google账号后,执行_googleSignIn.authenticate()方法时直接抛出异常,错误信息如下:
GoogleSignInExceptionCode.UNKNOWN_ERROR, [28444], Developer console is not set up correctly, null
项目基础配置说明
- 完全没有使用Firebase,纯靠Google Cloud Console做OAuth配置
- 目前用的是Android Studio默认的debug keystore(之前也试过自己生成的自定义jks)
- 仅引入了
google_sign_in: ^7.2.0和flutter_secure_storage两个相关依赖
已经尝试过的所有解决方法(避免重复踩坑)
- 本地签名配置全量测试
- 执行
gradlew signingReport拿到所有debug/release环境的SHA1值 - 每个SHA1都在Cloud Console里单独创建对应的Android OAuth客户端,替换项目里的
serverClientId后测试,全部失败 - 甚至把默认keystore的SHA1也用上了,还是报同一个错误
- 执行
- 尝试Web类型OAuth客户端
- 按照GitHub上的某个建议,放弃Android客户端,创建了Web类型的OAuth客户端,用它的Client ID作为
serverClientId,依然无效
- 按照GitHub上的某个建议,放弃Android客户端,创建了Web类型的OAuth客户端,用它的Client ID作为
- 全网旧方案排查无效
- 翻遍了GitHub的issue和StackOverflow的旧回答,要么是针对更低版本
google_sign_in的解决方案,要么是Google Cloud Console界面已经迭代,旧教程里的配置项根本找不到地方操作
- 翻遍了GitHub的issue和StackOverflow的旧回答,要么是针对更低版本
关键代码片段
final String serverClientId_release = // 试过这个客户端ID "..............apps.googleusercontent.com"; final serverClientId_debug = "..............apps.googleusercontent.com"; final _tokensStorage = FlutterSecureStorage(); Future<void> _initialize() async { await _googleSignIn.initialize(serverClientId: serverClientId_debug); _firtsLoad = false; } Future<String> _getAcessToken() async { // 错误就在这行触发 final GoogleSignInAccount gUser = await _googleSignIn.authenticate(); final GoogleSignInClientAuthorization gAuth = await gUser.authorizationClient.authorizeScopes( _scopes, // 目前只填了"openid" ); await _sendInfoToBackend(gUser: gUser, gAuth: gAuth); await _writeAccessToken(accessToken: gAuth.accessToken); return gAuth.accessToken; }
我的怀疑方向
现在我严重怀疑是Google Cloud Console里的API或全局配置项漏开了——毕竟Google的Cloud API更新太快,网上的旧指南基本都过时了。比如是不是有某个必须启用的核心API没开?或者OAuth consent screen的配置有了新要求?
求助需求
希望能得到2024年最新的、纯Google Cloud Console(不用Firebase)配置Flutter Google登录的完整步骤,或者针对[28444]这个错误码的专属排查点。麻烦尽量不要贴旧链接,因为那些我基本都看过了,感谢各位大佬!




