Unknown GoogleAuthException while trying to get authorization token

I am trying to get the authorization token from Google+ using their sdk on Android, but it always raises a "Unknown GoogleAuthException"

Here is the code I'm using:

private static final String LOGIN_SCOPES = "https://www.googleapis.com/auth/plus.login " + "https://www.googleapis.com/auth/userinfo.email"; protected static final String SCOPES = "oauth2:server:client_id:" + BuildConfig.GOOGLE_SERVER_CLIENT_ID + ":api_scope:" + LOGIN_SCOPES; String token = GoogleAuthUtil.getToken( getApplicationContext(), Plus.AccountApi.getAccountName(googleApiClient), SCOPES); 

I doubled the client_id flag that I received from the Google console.

What really worries is that this code works for my placement style, with intermediate client_id, but for my client_id product that I just created this morning, I cannot get it to work.

Any idea?

+5
source share
2 answers

I finally found out what was going wrong. I used the Android client id, not the website . It turns out that in this case, Google+ cannot provide you with more detailed information about the error than "Unknown."

So, if someone encounters this “Unknown” exception from Google+, you can start checking these two points:

  • Are you using a web client identifier in your area (and not another)?
  • Are you 100% sure your SHA1 certificate is good?
+2
source

I had the same problem. I used a sample Auth project from sdk and I did its job.

+1
source

All Articles