Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public async interactiveLogin(options?: InteractiveLoginOptions): Promise {
let authResp: AuthResponse = { credentials: undefined, subscriptions: [] };
const fileTokenCache = new SimpleFileTokenCache();
if (fileTokenCache.isEmpty()) {
await open("https://microsoft.com/devicelogin");
authResp = await interactiveLoginWithAuthResponse({ ...options, tokenCache: fileTokenCache });
fileTokenCache.addSubs(authResp.subscriptions);
} else {
authResp.credentials = new DeviceTokenCredentials(undefined, undefined, fileTokenCache.first().userId, undefined, undefined, fileTokenCache);
authResp.subscriptions = fileTokenCache.listSubscriptions();
}
return authResp;
}