0

I integrated Google Drive API to my Android app but recently I noticed that this stop working, earlier everything was ok. Now I get GoogleAuthException: Unknown on getToken() function. I tested on Nexus 7 with Android 4.4.4. My app is compiled woth Google APIs 4.2.2.

Here is my code:

public Account getAccount() {
    if (mSelectedAccountName != null) {
        return mAccountManager.getAccountByName(mSelectedAccountName);
    }

    return null;
}

private void checkIfUserIsAuthenticated(Activity context, boolean showAuthActivity) {
    if (mSelectedAccountName != null) {
        try {
            Account account = getAccount();

            if (account != null) {
                mCredential.setSelectedAccountName(mSelectedAccountName);
                mService = getDriveService(mCredential);
                mCredential.getToken();
                mIsUserAuthenticated = true;
            }
        } catch (UserRecoverableAuthException e) {
            mIsUserAuthenticated = false;

            if (showAuthActivity) {
                showAuthenticationActivity(context, e.getIntent());
            }
        } catch (IOException e) {
            e.printStackTrace();
        } catch (GoogleAuthException e) {
            e.printStackTrace();
            mIsUserAuthenticated = false;
        }
    }
}

Does anybody know what can happened?

Bartosz Bialecki
  • 4,391
  • 10
  • 42
  • 64
  • Most likely there is a problem with your developer console entry. Make sure your signing certificate, package, etc are all correct. See https://developers.google.com/drive/android/auth – Cheryl Simon Aug 27 '14 at 16:40
  • I checked and certificate fingerprint is ok and as I said it worked earlier and I did not change anything with Google Drive. – Bartosz Bialecki Aug 28 '14 at 06:03

0 Answers0