From 24a54c91950876b6db256d2fcbbd924e5b956a7c Mon Sep 17 00:00:00 2001 From: Vinay Venu Date: Tue, 19 Sep 2023 10:08:20 +0530 Subject: [PATCH] #1041 | Clear keycloak auth token on unauthorized http response so that user is taken to login screen --- src/common/utils/httpClient.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/common/utils/httpClient.js b/src/common/utils/httpClient.js index 27dd2c2f6..45a182461 100644 --- a/src/common/utils/httpClient.js +++ b/src/common/utils/httpClient.js @@ -104,11 +104,9 @@ class HttpClient { } return fetchUtils.fetchJson(url, options).catch(error => { console.log(error.message); - if ( - error.message.indexOf("TokenExpiredException") !== -1 && - this.idp.idpType === IdpDetails.keycloak - ) + if (error.message === "Unauthorized" && this.idp.idpType === IdpDetails.keycloak) { this.idp.clearAccessToken(); + } throw error; }); }