in src/login/adal/AdalAuthProvider.ts [67:99]
public async loginSilent(environment: Environment, tenantId: string, migrateToken?: boolean): Promise<TokenResponse[]> {
const storedCreds: string | undefined = await getStoredCredentials(environment, migrateToken);
if (!storedCreds) {
throw new AzureLoginError(localize('azure-account.refreshTokenMissing', 'Not signed in'));
}
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let parsedCreds: any;
let tokenResponse: TokenResponse | null = null;
try {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
parsedCreds = JSON.parse(storedCreds);
} catch {
tokenResponse = await tokenFromRefreshToken(environment, storedCreds, tenantId)
}
if (parsedCreds) {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const { redirectionUrl, code } = parsedCreds;
if (!redirectionUrl || !code) {
throw new AzureLoginError(localize('azure-account.malformedCredentials', "Stored credentials are invalid"));
}
tokenResponse = await getTokenWithAuthorizationCode(clientId, Environment.AzureCloud, redirectionUrl, tenantId, code);
}
if (!tokenResponse) {
throw new AzureLoginError(localize('azure-account.missingTokenResponse', "Using stored credentials failed"));
}
return getTokensFromToken(environment, tenantId, tokenResponse);
}