@redocly/cli
Version:
[@Redocly](https://redocly.com) CLI is your all-in-one OpenAPI utility. It builds, manages, improves, and quality-checks your OpenAPI descriptions, all of which comes in handy for various phases of the API Lifecycle. Create your own rulesets to make API g
26 lines • 1.04 kB
JavaScript
import { logger } from '@redocly/openapi-core';
import { exitWithError } from '../utils/error.js';
import { RedoclyOAuthClient } from '../auth/oauth-client.js';
import { getReuniteUrl } from '../reunite/api/index.js';
export async function handleLogin({ argv, version, config }) {
const residency = argv.residency || config?.resolvedConfig?.residency;
const reuniteUrl = getReuniteUrl(residency);
try {
const oauthClient = new RedoclyOAuthClient('redocly-cli', version);
await oauthClient.login(reuniteUrl);
}
catch {
if (argv.residency) {
exitWithError(`❌ Connection to ${reuniteUrl} failed.`);
}
else {
exitWithError(`❌ Login failed. Please check your credentials and try again.`);
}
}
}
export async function handleLogout({ version }) {
const oauthClient = new RedoclyOAuthClient('redocly-cli', version);
oauthClient.logout();
logger.output('Logged out from the Redocly account. ✋ \n');
}
//# sourceMappingURL=auth.js.map