Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Api and android Oauth INVALID_AUDIENCE error

I am getting a GoogleAuthException: Unknown error, while doing a GoogleAuthUtil.getToken.

Just before the exception I see

GLSUser: GLS error: INVALID_AUDIENCE <email> audience:server:client_id:xxx.apps.googleusercontent.com

I have set the SHA1 from my release key , the package name, to the google api project. (Which by the way is being used successfully for GCM. )

like image 340
Alok Avatar asked Feb 22 '13 18:02

Alok


1 Answers

Looks like that should work; here's the scope-init code from my app which does work.

private static final String SCOPE = "audience:server:client_id:" + SERVER_CLIENT_ID;

So it smells to me like there's a problem with the client id. Remember that

  1. You have to have a project with two client ids
  2. One is the one for your android app, with the SHA & package & so on
  3. The other is for the server side that you're going to send the token off to

It's the client ID from #3 that goes after ...:client_id:

like image 193
Tim Bray Avatar answered Sep 25 '22 08:09

Tim Bray