From ab184912e642befbda41835ffb11311f56c94f76 Mon Sep 17 00:00:00 2001 From: Tyler Leonhardt Date: Thu, 23 Sep 2021 16:46:23 -0700 Subject: [PATCH] make sure we splice the sessions if they have the same set of scopes for github authentication --- extensions/github-authentication/src/github.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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 {