GoogleAuthException from GoogleAuthUtil.getToken() for scope oauth2:https://www.googleapis.com/auth/userinfo.profile

StackOverflow https://stackoverflow.com/questions/22089913

Question

I am trying to obtain basic user info using Android Google-play-services library. I started with the sample project that comes with the SDK : sdk\extras\google\google_play_services\samples\auth. It runs fine. My account authenticates and I can retrieve my public user info.

The problem starts when I rename the project from com.google.android.gms.auth.sample.helloauth to com.mydomain.myapp - GoogleAuthUtil.getToken() throws GoogleAuthException. Naturally one would think there is a problem with credentials. However, I am not able to find one. In the developers console I have Google Play Android Developer API turned on, and under Credentials:

Client ID for Android application
Client ID   XXXXX.apps.googleusercontent.com
Redirect URIs
urn:ietf:wg:oauth:2.0:oob
http://localhost
Package name    com.mydomain.myapp
Certificate fingerprint (SHA1)  XX:YY:ZZ:70:aa:57:f4:b2:3e:9b:b3:08:16:c5:19:45:2e:18:f8:5d
Deep linking    Enabled

and my fingerprint is correct. (It works fine for other APIs such as Google maps). How do I debug this problem?

EDIT: I have the exact same problem with the newer Google+ scope (https://www.googleapis.com/auth/plus.login)

Was it helpful?

Solution

After some more debugging, the issue is certainly somewhere in the google cloud console infrastructure. I created a brand new project with a new name, added Google Play Android Developer API permissions, deleted the OAuth Android credentials from the old project, created the exact same OAuth credentials in the new project, and everything works. Great job Google. :-(

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top