From 8fb506f4c603a6c6200a70798b2e6c9d832eab65 Mon Sep 17 00:00:00 2001 From: Praful Makani Date: Thu, 21 Feb 2019 16:33:56 +0530 Subject: [PATCH 1/2] Replaced invalidateToken method to clearToken --- .../android/gms/auth/GoogleAccountCredential.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) 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..47ab68b0a 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 @@ -303,10 +303,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; + try { + if (response.getStatusCode() == 401 && !received401) { + received401 = true; + GoogleAuthUtil.clearToken(context, token); + return true; + } + } catch (GoogleAuthException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); } return false; } From 3cb2025eb7c299ae6faffd80367eea25c21fa5ee Mon Sep 17 00:00:00 2001 From: Praful Makani Date: Thu, 21 Feb 2019 21:00:21 +0530 Subject: [PATCH 2/2] Fix throw exception --- .../android/gms/auth/GoogleAccountCredential.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) 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 47ab68b0a..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,8 +301,8 @@ public void intercept(HttpRequest request) throws IOException { } @Override - public boolean handleResponse( - HttpRequest request, HttpResponse response, boolean supportsRetry) { + public boolean handleResponse(HttpRequest request, HttpResponse response, boolean supportsRetry) + throws IOException { try { if (response.getStatusCode() == 401 && !received401) { received401 = true; @@ -310,9 +310,7 @@ public boolean handleResponse( return true; } } catch (GoogleAuthException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); + throw new GoogleAuthIOException(e); } return false; }