@@ -136,6 +136,7 @@ const authSetup = function () {
136136 logger ( "Error in refreshing token: " , e )
137137 if ( e . error && ( ( e . error == "login_required" ) || ( e . error == "timeout" ) ) ) {
138138 clearInterval ( callRefreshTokenFun ) ;
139+ clearAllCookies ( ) ;
139140 }
140141 }
141142 ) ;
@@ -148,6 +149,7 @@ const authSetup = function () {
148149 logger ( "Error in refreshing token: " , e )
149150 if ( e . error && ( ( e . error == "login_required" ) || ( e . error == "timeout" ) ) ) {
150151 clearInterval ( callRefreshTokenFun ) ;
152+ clearAllCookies ( ) ;
151153 }
152154 }
153155 ) ;
@@ -192,22 +194,26 @@ const authSetup = function () {
192194 } ;
193195
194196 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 ) ;
197+ clearAllCookies ( ) ;
206198 auth0 . logout ( {
207199 returnTo : host
208200 } ) ;
209201 } ;
210202
203+ const clearAllCookies = function ( ) {
204+ // TODO
205+ setCookie ( tcJWTCookie , "" , - 1 ) ;
206+ setCookie ( v3JWTCookie , "" , - 1 ) ;
207+ setCookie ( tcSSOCookie , "" , - 1 ) ;
208+
209+ // to clear any old session
210+ setCookie ( 'auth0Jwt' , "" , - 1 ) ;
211+ setCookie ( 'zendeskJwt' , "" , - 1 ) ;
212+ setCookie ( 'auth0Refresh' , "" , - 1 ) ;
213+ // for scorecard
214+ setCookie ( 'JSESSIONID' , "" , - 1 ) ;
215+ }
216+
211217 const isLoggedIn = function ( ) {
212218 var token = getCookie ( tcJWTCookie ) ;
213219 return token ? ! isTokenExpired ( token ) : false ;
0 commit comments