protected function execute(InputInterface $input, OutputInterface $output)
{
// Disable the API token for this command.
if ($this->api()->hasApiToken()) {
throw new \Exception('Cannot log in: an API token is set');
}
// Login can only happen during interactive use.
if (!$input->isInteractive()) {
throw new \Exception('Non-interactive login not supported');
}
$this->stdErr->writeln('Please log in using your <info>' . self::$config->get('service.name') . '</info> account.');
$this->stdErr->writeln('');
$this->configureAccount($input, $this->stdErr);
$this->api()->clearCache();
$info = $this->api()->getClient(false)->getAccountInfo();
if (isset($info['mail'])) {
$this->stdErr->writeln('');
$this->stdErr->writeln('You are logged in as <info>' . $info['mail'] . '</info>.');
}
}