Skip to content

Got Error: DeveloperError Exception of type 'Google.GoogleSignIn+SignInException' was thrown. #49

Open
@vanilla-plus

Description

@vanilla-plus

I've run into this error while using the example scene as directed in the ReadMe. Unlike outcomes other users have reported before, I'm 99% certain the issue isn't related to the spelling of the webClientID string (process thus far detailed below) so I was wondering what else it could possibly be.

Here's a list of the things I've triple-checked:

  • Created an API key and web application OAuth 2.0 client ID on Google Cloud Platform and enabled the required APIs.
  • webClientID string in the SignInSampleScript scene; I copied/pasted the client_ID where the client_type is '3' directly from the google-services.json file, which was downloaded from the 'API & Settings' -> 'Credentials' page on Google Cloud Platform. I've also set up a Debug.Log to ensure its carried through correctly to the OnSignIn function (one user reported Unity was defaulting this string to its initial value)
  • The package_name from the same file where client_type is '1'. This is copied and pasted into Unity's player settings and also on the OAuth 2.0 entry in Credentials page of 'API & Settings' page of Google Cloud Platform.
  • The keystore file, key alias and their passwords are present in Unity's player settings. We aren't using debug.keystore and have created our own keystore file.
  • The SHA-1 fingerprint has been copied using the [keytool -exportcert -list -v -alias -keystore ] console command successfully and I've pasted it into the OAuth 2.0 entry in 'API & Settings' -> 'Credentials' page on Google Cloud Platform.
  • I've run AndroidResolver from the Unity -> Assets -> Play Services Resolver menu after each change, just to ensure up-to-dated-ness.

I managed to log each of the GoogleSignInStatusCode enum flag states returned with the GoogleSignIn.SignInException task and the results look like this:

  • Error.Status.Flag[Success] Is it this? [True]
  • Error.Status.Flag[ApiNotConnected] Is it this? [False]
  • Error.Status.Flag[Canceled] Is it this? [True]
  • Error.Status.Flag[Interrupted] Is it this? [False]
  • Error.Status.Flag[InvalidAccount] Is it this? [True]
  • Error.Status.Flag[Timeout] Is it this? [False]
  • Error.Status.Flag[DeveloperError] Is it this? [True]
  • Error.Status.Flag[InternalError] Is it this? [False]
  • Error.Status.Flag[NetworkError] Is it this? [False]
  • Error.Status.Flag[Error] Is it this? [False]

According to the parameter summarys and remarks in GoogleSignInConfiguration.cs:

  • Success = "The operation was successful"
  • Canceled = "The result was canceled either due to client disconnect or cancel()"
  • InvalidAccount = "The client attempted to connect to the service with an invalid account name specified."
  • DeveloperError = "The application is misconfigured. This error is not recoverable. The developer should look at the logs after this to determine more actionable information."

I'm not too sure what to make of these results (succeeded and cancelled are both true and it threw an error?). It appears I can specify an AccountName parameter for GoogleSignInConfiguration (null uses the 'default'), what format could that take?

Also, the remarks for DeveloperError mention more information being in the logs. I found the line:

  • TokenRequestor: You have wrong OAuth2 related configurations, please check. Detailed error: INVALID_AUDIENCE

Apparently this is a pretty common error and relates to some misconfiguration of the client ID settings. According to Mengcheng Duan back in 2014:

"Invalid audience means either your Android app is not registered in Google cloud console or it is registered in a different project other than the one where the server client_id lives.
The 403 is caused by the browser API key referer restrictions. Currently the workaround is to create a new browser/android API key without referer/package restrictions."

I've tried creating new client IDs several times with different settings and to no avail. Any help would be greatly appreciated in the mean time if the answer is clear! :)

Edit: After a lot of trial and error, the problem has been solved and it seemed to be something no one has pointed to yet. The action that switched it from not working to working was signing up as a Play developer (registration fee included) to gain access to the Google Play Console, and then seemingly creating an OAuth client under 'API Access' (its a big button, can't miss it). It makes sense I suppose, but it's strange that it hasn't been mentioned anywhere else in the documentation. Hopefully this report can act as a guide if anyone else ends up in a similar position.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions