@@ -81,17 +81,21 @@ export class GitHubServer {
8181
8282 const state = uuid ( ) ;
8383 const callbackUri = await vscode . env . asExternalUri ( vscode . Uri . parse ( `${ vscode . env . uriScheme } ://vscode.github-authentication/did-authenticate` ) ) ;
84- const clientDetails = scopes === 'vso' ? ClientRegistrar . getGitHubAppDetails ( ) : ClientRegistrar . getClientDetails ( callbackUri ) ;
85- const uri = scopes !== 'vso'
86- ? vscode . Uri . parse ( `https://${ AUTH_RELAY_SERVER } /authorize/?callbackUri=${ encodeURIComponent ( callbackUri . toString ( ) ) } &scope=${ scopes } &state=${ state } &responseType=code` )
87- : vscode . Uri . parse ( `https://github.com/login/oauth/authorize?redirect_uri=${ encodeURIComponent ( callbackUri . toString ( ) ) } &scope=${ scopes } &state=${ state } &client_id=${ clientDetails . id } ` ) ;
84+ let uri = vscode . Uri . parse ( `https://${ AUTH_RELAY_SERVER } /authorize/?callbackUri=${ encodeURIComponent ( callbackUri . toString ( ) ) } &scope=${ scopes } &state=${ state } &responseType=code` ) ;
85+ if ( scopes === 'vso' ) {
86+ const clientDetails = ClientRegistrar . getGitHubAppDetails ( ) ;
87+ uri = vscode . Uri . parse ( `https://github.com/login/oauth/authorize?redirect_uri=${ encodeURIComponent ( callbackUri . toString ( ) ) } &scope=${ scopes } &state=${ state } &client_id=${ clientDetails . id } ` ) ;
88+ }
8889
8990 vscode . env . openExternal ( uri ) ;
9091
9192 return promiseFromEvent ( uriHandler . event , exchangeCodeForToken ( state , AUTH_RELAY_SERVER , ( code ) => {
92- return scopes !== 'vso'
93- ? `/token?code=${ code } &state=${ state } `
94- : `/login/oauth/access_token?client_id=${ clientDetails . id } &client_secret=${ clientDetails . secret } &state=${ state } &code=${ code } &authServer=github.com` ;
93+ if ( scopes === 'vso' ) {
94+ const clientDetails = ClientRegistrar . getGitHubAppDetails ( ) ;
95+ return `/login/oauth/access_token?client_id=${ clientDetails . id } &client_secret=${ clientDetails . secret } &state=${ state } &code=${ code } &authServer=github.com` ;
96+ } else {
97+ return `/token?code=${ code } &state=${ state } ` ;
98+ }
9599 } ) ) . finally ( ( ) => {
96100 this . updateStatusBarItem ( false ) ;
97101 } ) ;
0 commit comments