Skip to content

Commit 1c5f8c5

Browse files
author
Sachin Maheshwari
committed
clearing cookies on refresh fail
1 parent eab3dbf commit 1c5f8c5

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

web-assets/js/setupAuth0WithRedirect.js

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ const authSetup = function () {
148148
logger("Error in refreshing token: ", e)
149149
if (e.error && ((e.error == "login_required") || (e.error == "timeout"))) {
150150
clearInterval(callRefreshTokenFun);
151+
clearAllCookies();
151152
}
152153
}
153154
);
@@ -192,22 +193,26 @@ const authSetup = function () {
192193
};
193194

194195
const logout = function () {
195-
// TODO
196-
setCookie(tcJWTCookie, "", -1);
197-
setCookie(v3JWTCookie, "", -1);
198-
setCookie(tcSSOCookie, "", -1);
199-
200-
// to clear any old session
201-
setCookie('auth0Jwt', "", -1);
202-
setCookie('zendeskJwt', "", -1);
203-
setCookie('auth0Refresh', "", -1);
204-
// for scorecard
205-
setCookie('JSESSIONID', "", -1);
196+
clearAllCookies();
206197
auth0.logout({
207198
returnTo: host
208199
});
209200
};
210201

202+
const clearAllCookies = function() {
203+
// TODO
204+
setCookie(tcJWTCookie, "", -1);
205+
setCookie(v3JWTCookie, "", -1);
206+
setCookie(tcSSOCookie, "", -1);
207+
208+
// to clear any old session
209+
setCookie('auth0Jwt', "", -1);
210+
setCookie('zendeskJwt', "", -1);
211+
setCookie('auth0Refresh', "", -1);
212+
// for scorecard
213+
setCookie('JSESSIONID', "", -1);
214+
}
215+
211216
const isLoggedIn = function () {
212217
var token = getCookie(tcJWTCookie);
213218
return token ? !isTokenExpired(token) : false;

0 commit comments

Comments
 (0)