Skip to content

Commit 5c4c5cb

Browse files
author
Prithvi Kanherkar
committed
Added helper for clearing cookie items
1 parent 9d8a81a commit 5c4c5cb

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

lib/msal-core/src/cache/AuthCache.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,10 @@ export class AuthCache extends BrowserStorage {// Singleton
141141
}
142142

143143
public clearMsalCookie(): void {
144-
this.setItemCookie(CacheKeys.NONCE_IDTOKEN, "", -1);
145-
this.setItemCookie(CacheKeys.STATE_LOGIN, "", -1);
146-
this.setItemCookie(CacheKeys.LOGIN_REQUEST, "", -1);
147-
this.setItemCookie(CacheKeys.STATE_ACQ_TOKEN, "", -1);
144+
this.clearItemCookie(CacheKeys.NONCE_IDTOKEN);
145+
this.clearItemCookie(CacheKeys.STATE_LOGIN);
146+
this.clearItemCookie(CacheKeys.LOGIN_REQUEST);
147+
this.clearItemCookie(CacheKeys.STATE_ACQ_TOKEN);
148148
}
149149

150150
/**

lib/msal-core/src/cache/BrowserStorage.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ export class BrowserStorage {// Singleton
9494
return "";
9595
}
9696

97+
clearItemCookie(cName: string) {
98+
this.setItemCookie(cName, "", -1);
99+
}
100+
97101
getCookieExpirationTime(cookieLifeDays: number): string {
98102
const today = new Date();
99103
const expr = new Date(today.getTime() + cookieLifeDays * 24 * 60 * 60 * 1000);

0 commit comments

Comments
 (0)