File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -619,7 +619,17 @@ export class CodeQLCliServer implements Disposable {
619619 progressReporter ,
620620 async ( line ) => {
621621 if ( line . startsWith ( "Enter value for --github-auth-stdin" ) ) {
622- return credentials . getAccessToken ( ) ;
622+ try {
623+ return await credentials . getAccessToken ( ) ;
624+ } catch ( e ) {
625+ // If the user cancels the authentication prompt, we still need to give a value to the CLI.
626+ // By giving a potentially invalid value, the user will just get a 401/403 when they try to access a
627+ // private package and the access token is invalid.
628+ // This code path is very rare to hit. It would only be hit if the user is logged in when
629+ // starting the command, then logging out before the getAccessToken() is called again and
630+ // then cancelling the authentication prompt.
631+ return accessToken ;
632+ }
623633 }
624634
625635 return undefined ;
You can’t perform that action at this time.
0 commit comments