In my Android application, I am trying to get google token to verify at my google app engine backend server. But I always get this exception :
com.google.android.gms.auth.GoogleAuthException: getToken(Unknown Source) exception
My code :
private Account mAccount = AccountManager.get(this).getAccountsByType(GoogleAuthUtil.GOOGLE_ACCOUNT_TYPE)[0];
private static final String SCOPE = "audience:server:client_id:" +Constants.WED_CLIENT_ID;
String token = GoogleAuthUtil.getToken(LoginActivity.this, mAccount.name, SCOPE);
I have tried every solution proposed in Stackoverflow.
After several hours, I found that in your scope string ("audience:server:client_id:..."
) you have to use the Client ID of the web application, not the android one.
The client ID of the android app is unused. It's only here to link the package name of your android app with your web app.