diff --git a/google-api-client-android/src/main/java/com/google/api/client/googleapis/extensions/android/gms/auth/GoogleAccountCredential.java b/google-api-client-android/src/main/java/com/google/api/client/googleapis/extensions/android/gms/auth/GoogleAccountCredential.java index 7a413eb13..74bec3625 100644 --- a/google-api-client-android/src/main/java/com/google/api/client/googleapis/extensions/android/gms/auth/GoogleAccountCredential.java +++ b/google-api-client-android/src/main/java/com/google/api/client/googleapis/extensions/android/gms/auth/GoogleAccountCredential.java @@ -301,12 +301,16 @@ public void intercept(HttpRequest request) throws IOException { } @Override - public boolean handleResponse( - HttpRequest request, HttpResponse response, boolean supportsRetry) { - if (response.getStatusCode() == 401 && !received401) { - received401 = true; - GoogleAuthUtil.invalidateToken(context, token); - return true; + public boolean handleResponse(HttpRequest request, HttpResponse response, boolean supportsRetry) + throws IOException { + try { + if (response.getStatusCode() == 401 && !received401) { + received401 = true; + GoogleAuthUtil.clearToken(context, token); + return true; + } + } catch (GoogleAuthException e) { + throw new GoogleAuthIOException(e); } return false; }