Flutter: google_sign_in exception - Developer console is not set up correctly


For the past two days, I have been attempting to resolve the GoogleSignInException error (GoogleSignInExceptionCode.UNKNOWN_ERROR, [28444], Developer console is not set up correctly, null). I have consulted other solutions on GitHub and StackOverflow, but they have not been helpful. Currently, I am working on creating a sign-in with Google button, but when I select an account and execute the _googleSignIn.authenticate() method, this error occurs.

I have already tried all available jks keys sha1 (both mine and those from Android Studio) values for substitution in the Google Cloud OAuth client (I created several such Cloud console oauth2 clients with all possible sha1s and tried each client ID accordingly!), but the error persists. The screenshot shows part of the default android JKS hash, which I am currently using, but it is also not working. In my project, I only use Flutter google_sign_in: ^7.2.0, my own jks (but default Android Studio jks now ) and Google Cloud Console (NOT FIREBASE!) for login. I may have missed some API settings in the Cloud Console. According to the advice on Github, I attempted to create a web client, not an Android one, which also did not solve the problem.

gradlew signingReport's output

Just in case, I'll clarify that it's possible that I really didn't set up something correctly in the console itself (based on the fact that I kind of tried all the local solutions), since the Cloud API changes too often, and all the guides and solutions on the Internet become irrelevant (accordingly, I expect an up-to-date solution from you rather than a link to an answer to a similar question).

      final String serverClientId_release = // Also tried
          "..............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 { // The error is caused here
        final GoogleSignInAccount gUser = await _googleSignIn.authenticate();
    
        final GoogleSignInClientAuthorization gAuth = await gUser.authorizationClient.authorizeScopes(
          _scopes, // only "openid" here now
        );
    
        await _sendInfoToBackend(gUser: gUser, gAuth: gAuth);
    
        await _writeAccessToken(accessToken: gAuth.accessToken);
    
        return gAuth.accessToken;
      }
2
Feb 11 at 4:15 PM
User AvatarKaJIoeLLIka
#android#flutter#google-cloud-platform#oauth-2.0#google-signin

Accepted Answer

I think the problem is in my Android Studio emulator (the comment above from Tim Katzgrau). I really forgot to check the code on my phone, not on the emulator (yes, this is really stupid (I fell into a stupor after two days of continuous bug fixing and apparently missed this moment because of its simplicity)) before asking a question here. As soon as I launched the app on a real Android device, the error disappeared. I recommend everyone to test sensitive libraries on your real devices (well, or by

> using the dedicated Google Play System Image emulators in Android Studio — Tim Katzgrau

if you have an error similar to mine).

Thanks to the commenters who responded to my question, I really needed any feedback.

UPD:
I didn't even notice a critical error in my code: I made

_googleSignIn.initialize( serverClientId: client_id // BUT THERE SHOULD BE clientID: [client id] )
User AvatarKaJIoeLLIka
Feb 13 at 10:37 AM
0