Skip to content

Commit

Permalink
update auth status check
Browse files Browse the repository at this point in the history
  • Loading branch information
tatomyr committed Feb 18, 2025
1 parent 0cc31f7 commit 2e60e06
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/cli/src/utils/miscellaneous.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ import { outputExtensions } from '../types';
import { version } from './update-version-notifier';
import { DESTINATION_REGEX } from '../commands/push';
import fetch, { DEFAULT_FETCH_TIMEOUT } from './fetch-with-timeout';
import { RedoclyOAuthClient } from '../auth/oauth-client';
import { getReuniteUrl } from '../reunite/api';

import type { Arguments } from 'yargs';
import type {
Expand Down Expand Up @@ -565,7 +567,9 @@ export async function sendTelemetry(
} = argv;
const event_time = new Date().toISOString();
const redoclyClient = new RedoclyClient();
const logged_in = redoclyClient.hasTokens();
const oauthClient = new RedoclyOAuthClient('redocly-cli', version);
const reuniteUrl = getReuniteUrl(argv.residency as string | undefined);
const logged_in = redoclyClient.hasTokens() || (await oauthClient.isAuthorized(reuniteUrl));
const data: Analytics = {
event: 'cli_command',
event_time,
Expand Down

0 comments on commit 2e60e06

Please sign in to comment.