@@ -3,6 +3,12 @@ import Application from "./application";
33import { Msal } from "./xal" ;
44import AuthTokenStore from "./helpers/tokenstore" ;
55import { defaultSettings } from "../renderer/context/userContext.defaults" ;
6+ import {
7+ clearStreamToken ,
8+ } from './helpers/streamTokenStore' ;
9+ import {
10+ clearWebToken ,
11+ } from './helpers/webTokenStore' ;
612
713export default class Authentication {
814 _application : Application ;
@@ -142,6 +148,10 @@ export default class Authentication {
142148 __filename + "[getTokens()] Failed to retrieve web tokens:" ,
143149 error ,
144150 ) ;
151+ clearStreamToken ( ) ;
152+ clearWebToken ( ) ;
153+ this . _tokenStore . clear ( ) ;
154+ this . _tokenStore . removeAll ( ) ;
145155 dialog . showMessageBox ( {
146156 message :
147157 "failedToRetrieveWebTokens" +
@@ -157,6 +167,10 @@ export default class Authentication {
157167 "[startSilentFlow()] Failed to retrieve streaming tokens:" ,
158168 err ,
159169 ) ;
170+ clearStreamToken ( ) ;
171+ clearWebToken ( ) ;
172+ this . _tokenStore . clear ( ) ;
173+ this . _tokenStore . removeAll ( ) ;
160174 dialog . showMessageBox ( {
161175 message :
162176 "failedToRetrieveStreamingTokens" +
@@ -217,6 +231,10 @@ export default class Authentication {
217231 "[doPollForDeviceCodeAuth()] Error during devicecode polling auth:" ,
218232 error ,
219233 ) ;
234+ clearStreamToken ( ) ;
235+ clearWebToken ( ) ;
236+ this . _tokenStore . clear ( ) ;
237+ this . _tokenStore . removeAll ( ) ;
220238 dialog . showErrorBox (
221239 "Error" ,
222240 "Failed to perform MSAL authentixation: " + JSON . stringify ( error ) ,
@@ -287,6 +305,10 @@ export default class Authentication {
287305 "[startAuthflow()] Error during devicecode polling auth:" ,
288306 error ,
289307 ) ;
308+ clearStreamToken ( ) ;
309+ clearWebToken ( ) ;
310+ this . _tokenStore . clear ( ) ;
311+ this . _tokenStore . removeAll ( ) ;
290312 dialog . showErrorBox (
291313 "Error" ,
292314 "Failed to perform MSAL authentixation: " + JSON . stringify ( error ) ,
@@ -301,6 +323,10 @@ export default class Authentication {
301323 "[startAuthflow()] Error during devicecode auth:" ,
302324 error ,
303325 ) ;
326+ clearStreamToken ( ) ;
327+ clearWebToken ( ) ;
328+ this . _tokenStore . clear ( ) ;
329+ this . _tokenStore . removeAll ( ) ;
304330 dialog . showErrorBox (
305331 "Error" ,
306332 "errorAuthentificationUser" +
0 commit comments