diff --git a/lib/msal-core/src/Configuration.ts b/lib/msal-core/src/Configuration.ts index 49a4018181..cd86570da5 100644 --- a/lib/msal-core/src/Configuration.ts +++ b/lib/msal-core/src/Configuration.ts @@ -10,7 +10,11 @@ import { TelemetryEmitter } from "./telemetry/TelemetryTypes" * - local storage: MSAL uses browsers local storage to store its cache * - session storage: MSAL uses the browsers session storage to store its cache */ -export type CacheLocation = "localStorage" | "sessionStorage"; +export enum CacheLocationChoices { + LocalStorage = "localStorage", + SessionStorage = "sessionStorage" +} +export type CacheLocation = CacheLocationChoices.LocalStorage | CacheLocationChoices.SessionStorage; /** * Defaults for the Configuration Options @@ -120,7 +124,7 @@ const DEFAULT_AUTH_OPTIONS: AuthOptions = { }; const DEFAULT_CACHE_OPTIONS: CacheOptions = { - cacheLocation: "sessionStorage", + cacheLocation: CacheLocationChoices.SessionStorage, storeAuthStateInCookie: false }; @@ -157,4 +161,3 @@ export function buildConfiguration({ auth, cache = {}, system = {}, framework = }; return overlayedConfig; } - diff --git a/lib/msal-core/src/Constants.ts b/lib/msal-core/src/Constants.ts index 21c1992380..aa8fa107cb 100644 --- a/lib/msal-core/src/Constants.ts +++ b/lib/msal-core/src/Constants.ts @@ -1,4 +1,4 @@ -import { CacheLocation } from "./Configuration"; +import { CacheLocation, CacheLocationChoices } from "./Configuration"; import { InteractionRequiredAuthErrorMessage as InteractionError } from "./error/InteractionRequiredAuthError"; // Copyright (c) Microsoft Corporation. All rights reserved. @@ -80,8 +80,8 @@ export class Constants { static get openidScope(): string { return "openid"; } static get profileScope(): string { return "profile"; } - static get cacheLocationLocal(): CacheLocation { return "localStorage"; } - static get cacheLocationSession(): CacheLocation { return "sessionStorage"; } + static get cacheLocationLocal(): CacheLocation { return CacheLocationChoices.LocalStorage; } + static get cacheLocationSession(): CacheLocation { return CacheLocationChoices.SessionStorage; } static get interactionTypeRedirect(): InteractionType { return "redirectInteraction"; } static get interactionTypePopup(): InteractionType { return "popupInteraction"; }