File tree Expand file tree Collapse file tree 4 files changed +26
-2
lines changed
Expand file tree Collapse file tree 4 files changed +26
-2
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @redocly/openapi-core " : patch
3+ " @redocly/cli " : patch
4+ ---
5+
6+ Added support for the ` verbose ` option in the ` login ` command to provide additional output during authentication.
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ export class RedoclyOAuthClient {
3636
3737 const credentials = await deviceFlow . run ( ) ;
3838 if ( ! credentials ) {
39- throw new Error ( 'Failed to login' ) ;
39+ throw new Error ( 'Failed to login. No credentials received. ' ) ;
4040 }
4141 this . saveCredentials ( credentials ) ;
4242 }
Original file line number Diff line number Diff line change @@ -8,14 +8,27 @@ import type { CommandArgs } from '../wrapper.js';
88export type LoginArgv = {
99 residency ?: string ;
1010 config ?: string ;
11+ verbose ?: boolean ;
1112} ;
1213
1314export async function handleLogin ( { argv, config } : CommandArgs < LoginArgv > ) {
1415 const reuniteUrl = getReuniteUrl ( config , argv . residency ) ;
1516 try {
1617 const oauthClient = new RedoclyOAuthClient ( ) ;
18+
19+ if ( argv . verbose ) {
20+ logger . info ( `OAuth client initialized.\n` ) ;
21+ logger . info ( `Local credentials file path: ${ oauthClient . credentialsFilePath } \n` ) ;
22+ }
23+
1724 await oauthClient . login ( reuniteUrl ) ;
18- } catch {
25+ } catch ( error ) {
26+ if ( argv . verbose ) {
27+ logger . error ( `Residency: ${ argv . residency } .\n` ) ;
28+ logger . error ( `Login URL: ${ reuniteUrl } .\n` ) ;
29+ logger . error ( error . stack || error . message ) ;
30+ }
31+
1932 if ( argv . residency ) {
2033 exitWithError ( `❌ Connection to ${ reuniteUrl } failed.` ) ;
2134 } else {
Original file line number Diff line number Diff line change @@ -490,6 +490,11 @@ yargs(hideBin(process.argv))
490490 requiresArg : true ,
491491 type : 'string' ,
492492 } ,
493+ verbose : {
494+ alias : 'v' ,
495+ describe : 'Apply verbose mode.' ,
496+ type : 'boolean' ,
497+ } ,
493498 } ) ,
494499 ( argv ) => {
495500 commandWrapper ( handleLogin ) ( argv ) ;
You can’t perform that action at this time.
0 commit comments