From 11ec8269ed89b4abd1176dfc9d515498fbe72ca9 Mon Sep 17 00:00:00 2001 From: Rachel Macfarlane Date: Tue, 28 Apr 2020 15:17:05 -0700 Subject: [PATCH] Pass correct host for VSO token --- .../github-authentication/src/githubServer.ts | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/extensions/github-authentication/src/githubServer.ts b/extensions/github-authentication/src/githubServer.ts index a84153a8773..5e9b2732d46 100644 --- a/extensions/github-authentication/src/githubServer.ts +++ b/extensions/github-authentication/src/githubServer.ts @@ -89,16 +89,18 @@ export class GitHubServer { vscode.env.openExternal(uri); - return promiseFromEvent(uriHandler.event, exchangeCodeForToken(state, AUTH_RELAY_SERVER, (code) => { - if (scopes === 'vso') { - const clientDetails = ClientRegistrar.getGitHubAppDetails(); - return `/login/oauth/access_token?client_id=${clientDetails.id}&client_secret=${clientDetails.secret}&state=${state}&code=${code}&authServer=github.com`; - } else { - return `/token?code=${code}&state=${state}`; - } - })).finally(() => { - this.updateStatusBarItem(false); - }); + return promiseFromEvent(uriHandler.event, exchangeCodeForToken(state, + scopes === 'vso' ? 'github.com' : AUTH_RELAY_SERVER, + (code) => { + if (scopes === 'vso') { + const clientDetails = ClientRegistrar.getGitHubAppDetails(); + return `/login/oauth/access_token?client_id=${clientDetails.id}&client_secret=${clientDetails.secret}&state=${state}&code=${code}`; + } else { + return `/token?code=${code}&state=${state}`; + } + })).finally(() => { + this.updateStatusBarItem(false); + }); } private updateStatusBarItem(isStart?: boolean) {