Skip to content

Commit 92291d8

Browse files
committed
ensure initialize has completed
1 parent fa5a754 commit 92291d8

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/modules/authentication/msal-app.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { telemetry, errorTypes } from '../../telemetry';
22
import { SeverityLevel } from '@microsoft/applicationinsights-web';
3-
import { Configuration, LogLevel, PublicClientApplication } from '@azure/msal-browser';
3+
import { Configuration, LogLevel, PublicClientApplication, BrowserCacheLocation } from '@azure/msal-browser';
44

55
function getClientIdFromWindow() {
66
return window?.ClientId ?? '';
@@ -18,7 +18,7 @@ export const configuration: Configuration = {
1818
clientCapabilities: ['CP1']
1919
},
2020
cache: {
21-
cacheLocation: 'localStorage',
21+
cacheLocation: BrowserCacheLocation.LocalStorage,
2222
storeAuthStateInCookie: true,
2323
claimsBasedCachingEnabled: true
2424
},
@@ -68,6 +68,10 @@ export const configuration: Configuration = {
6868
}
6969
};
7070

71+
const initializeMsal = async (): Promise<void> => {
72+
await msalApplication.initialize();
73+
};
74+
7175
const msalApplication = new PublicClientApplication(configuration);
72-
msalApplication.initialize();
76+
await initializeMsal();
7377
export { msalApplication };

0 commit comments

Comments
 (0)