diff --git a/extensions/github-authentication/src/github.ts b/extensions/github-authentication/src/github.ts index 8ac3a181ad4..eb9a9e27d25 100644 --- a/extensions/github-authentication/src/github.ts +++ b/extensions/github-authentication/src/github.ts @@ -195,12 +195,13 @@ export class GitHubAuthenticationProvider implements vscode.AuthenticationProvid scopes: JSON.stringify(scopes), }); - const token = await this._githubServer.login(scopes.join(' ')); + const scopeString = scopes.join(' '); + const token = await this._githubServer.login(scopeString); this.afterTokenLoad(token); const session = await this.tokenToSession(token, scopes); const sessions = await this._sessionsPromise; - const sessionIndex = sessions.findIndex(s => s.id === session.id); + const sessionIndex = sessions.findIndex(s => s.id === session.id || s.scopes.join(' ') === scopeString); if (sessionIndex > -1) { sessions.splice(sessionIndex, 1, session); } else {