Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const provider = new MsalProvider({
clientId: authParams.clientId,
options: {
auth: {
clientId: authParams.clientId,
redirectUri: url.protocol + '//' + url.host + url.pathname
},
system: {
loadFrameTimeout: 10000
}
},
scopes
});
if ((UserAgentApplication.prototype as any).urlContainsHash(window.location.hash)) {
// the page should redirect again
return;
}
const handleProviderState = async () => {
// how do we handle when user can't sign in
// change to promise and return status
if (provider.state === ProviderState.SignedOut) {
provider.login({
loginHint: authParams.loginHint,
scopes: scopes || provider.scopes
});
} else if (provider.state === ProviderState.SignedIn) {
try {
const accessToken = await provider.getAccessTokenForScopes(...provider.scopes);
sessionStorage.removeItem(this._sessionStorageParametersKey);