From 95d70ae0f5f4c985455f913ddef14ebe75500656 Mon Sep 17 00:00:00 2001 From: Timur Sadykov Date: Mon, 17 May 2021 12:28:51 -0700 Subject: [PATCH] feat: Returning an issuer claim on request errors (#656) * logging issuer claim for service account on errors Co-authored-by: arithmetic1728 <58957152+arithmetic1728@users.noreply.github.com> --- .../oauth2/ServiceAccountCredentials.java | 26 +++++++++++++--- .../oauth2/ServiceAccountCredentialsTest.java | 31 +++++++++++++++++++ 2 files changed, 52 insertions(+), 5 deletions(-) diff --git a/oauth2_http/java/com/google/auth/oauth2/ServiceAccountCredentials.java b/oauth2_http/java/com/google/auth/oauth2/ServiceAccountCredentials.java index c0b3cab98..377b4dbf1 100644 --- a/oauth2_http/java/com/google/auth/oauth2/ServiceAccountCredentials.java +++ b/oauth2_http/java/com/google/auth/oauth2/ServiceAccountCredentials.java @@ -609,7 +609,10 @@ public boolean isRequired(HttpResponse response) { response = request.execute(); } catch (IOException e) { throw new IOException( - String.format("Error getting access token for service account: %s", e.getMessage()), e); + String.format( + "Error getting access token for service account: %s, iss: %s", + e.getMessage(), getIssuer()), + e); } GenericData responseData = response.parseAs(GenericData.class); @@ -648,7 +651,16 @@ public IdToken idTokenWithAudience(String targetAudience, List