Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private async acquireToken(
authParams: msal.AuthenticationParameters
): Promise {
let authResponse: msal.AuthResponse | undefined;
try {
logger.info("InteractiveBrowserCredential: attempting to acquire token silently");
authResponse = await this.msalObject.acquireTokenSilent(authParams);
} catch (err) {
if (err instanceof msal.AuthError) {
switch (err.errorCode) {
case "consent_required":
case "interaction_required":
case "login_required":
logger.warning(
`InteractiveBrowserCredential: authentication returned errorCode ${err.errorCode}`
);
break;
default:
logger.warning(`InteractiveBrowserCredential: failed to acquire token: ${err}`);
throw err;
}
}
}
let authPromise: Promise | undefined;