0

I have a function that attempts to get a token to query the Drive API:

private void getAuthTokenBlocking() {
    try {
        Account account =  AccountManager.get(sActivity).getAccountsByType(GoogleAuthUtil.GOOGLE_ACCOUNT_TYPE)[0];
        sToken = GoogleAuthUtil.getToken(sActivity, account.name, DriveScopes.DRIVE_READONLY);
    } catch (GooglePlayServicesAvailabilityException playEx) {
        Dialog alert = GooglePlayServicesUtil.getErrorDialog(
                playEx.getConnectionStatusCode(),
                sActivity,
                AUTH_REQUEST_CODE);
        alert.show();
    } catch (UserRecoverableAuthException userAuthEx) {
        userAuthEx.printStackTrace();
    } catch (IOException transientEx) {
        transientEx.printStackTrace();
    } catch (GoogleAuthException authEx) {
        authEx.printStackTrace();
    }
}

But I always get the following errors:

com.google.android.gms.auth.GoogleAuthException: Unknown
com.google.android.gms.auth.GoogleAuthUtil.getToken(Unknown Source)

I have tried all the solutions I could see, including prefixing the scope with "oauth2:".

pinoyyid
  • 21,499
  • 14
  • 64
  • 115
Dan Jenson
  • 961
  • 7
  • 20
  • Have you tried this two solutions? http://stackoverflow.com/questions/21261278/com-google-android-gms-auth-googleauthexception-gettokenunknown-source-except http://stackoverflow.com/questions/17906699/googleauthexception-unknown-while-doing-google-sso/25766367#25766367 – Rivero Jan 21 '15 at 18:48

1 Answers1

0

I figured this out; I was actually building from two different platforms and syncing on github. However, both of the debug keys were stored locally. So I set up token retrieval using the signature from one, while working on the other machine. Once I synced this key, I was able to authenticate.

Dan Jenson
  • 961
  • 7
  • 20