Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
cli.action.start(messages.tryToLog);
await cli.wait(waitTime);
let isLoggedin = false;
let repeatedCount = 0;
while (!isLoggedin) {
await cli.wait(waitTime);
try {
let resp = await authService.authenticate(code);
console.log(resp);
await writeToken(this, { token: resp.data.result });
isLoggedin = true;
}
catch (e) {
if (repeatedCount > maxRepeat) {
console.log(color.red(messages.problem_in_login_msg));
break;
}
repeatedCount++;
}
}
if (isLoggedin) {
try {
let value = await authService.overview(this);
let overview = JSON.stringify(value.data.result);
writeOverview(this, overview);
}
catch (e) {
common.logError(e);
}
cli.action.stop(messages.done_msg);