File tree Expand file tree Collapse file tree
packages/cli/src/commands/scorecard-classic/auth Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,19 +9,19 @@ import type { Config } from '@redocly/openapi-core';
99export async function handleLoginAndFetchToken ( config : Config ) : Promise < string | undefined > {
1010 const reuniteUrl = getReuniteUrl ( config , config . resolvedConfig ?. residency ) ;
1111 const oauthClient = new RedoclyOAuthClient ( ) ;
12- const isAuthorized = await oauthClient . isAuthorized ( reuniteUrl ) ;
12+ let accessToken = await oauthClient . getAccessToken ( reuniteUrl ) ;
1313
14- if ( ! isAuthorized ) {
14+ if ( ! accessToken ) {
1515 logger . info ( `\n${ blue ( 'Authentication required to fetch remote scorecard configuration.' ) } \n` ) ;
1616 logger . info ( `Please login to continue:\n` ) ;
1717
1818 try {
1919 await oauthClient . login ( reuniteUrl ) ;
20+ accessToken = await oauthClient . getAccessToken ( reuniteUrl ) ;
2021 } catch ( error ) {
2122 exitWithError ( `Login failed. Please try again or check your connection to ${ reuniteUrl } .` ) ;
2223 }
2324 }
2425
25- const token = await oauthClient . getAccessToken ( reuniteUrl ) ;
26- return token === null ? undefined : token ;
26+ return accessToken === null ? undefined : accessToken ;
2727}
You can’t perform that action at this time.
0 commit comments