For more context, this post follows this one.
To solve my previous problem, I tried to follow the solution presented here by Tim Bray: Verifying Back-End Calls from Android Apps
I declared two projects in Google APIs Console to get two Client IDs
- The first as "Web Application" with "localhost" as hostname (does it matter?)
- Client ID: XXXXXXXXXX.apps.googleusercontent.com
- The second as Android app with the package name specified in AndroidManifest.xml and SHA1 fingerprint (tried with debug.keystore and [my].keystore)
- Client ID: YYYYYYYYYY.apps.googleusercontent.com
Unfortunately I'm facing an exception in Android side:
com.google.android.gms.auth.GoogleAuthException: Unknown
at com.google.android.gms.auth.GoogleAuthUtil.getToken(Unknown Source)
at com.google.android.gms.auth.GoogleAuthUtil.getToken(Unknown Source)
at fr.barles.android.activity.LoginActivity$1.doInBackground(LoginActivity.java:66)
at fr.barles.android.activity.LoginActivity$1.doInBackground(LoginActivity.java:1)
at android.os.AsyncTask$2.call(AsyncTask.java:185)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
at java.util.concurrent.FutureTask.run(FutureTask.java:137)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1068)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:561)
at java.lang.Thread.run(Thread.java:1102)
On the line:
return GoogleAuthUtil.getToken(LoginActivity.this, account[0], "audience:server:client_id:XXXXXXXXXX.apps.googleusercontent.com");
What I am doing wrong?
Thanks in advance