Change:
Type: <bBug</bI just restarted Insiders and had to click through 4 GitHub auth requests. put up a dialog, requiring me to sign in. used a notification out a badge on the user icon Sync was also logged out, notifying me with another badge The first 3 opened GitHub and required me to re-check the orgs that the token has access to. Only Copilot provided feedback that the web flow succeeded, others silently accepted the auth. As users get more GitHub extensions, this will become worse. How can we make those auth requests happen a) less often, b) more controlled and, c) with less clicks/context switching. VS Code version: Code - Insiders 1.75.0-insider (, 2022-12-08T05:21:16.099Z) OS version: Darwin x64 22.1.0 Modes: Sandboxed: Yes <details<summaryGitHub Auth logs</summary2022-12-08 08:56:26.022 [info] Reading sessions from keychain... 2022-12-08 08:56:26.022 [info] Getting sessions for user:email... 2022-12-08 08:56:26.022 [info] Got 0 sessions for user:email... 2022-12-08 08:56:26.022 [info] Getting sessions for codespace,read:user,repo,user:email... 2022-12-08 08:56:26.022 [info] Got 0 sessions for codespace,read:user,repo,user:email... 2022-12-08 08:56:26.022 [info] Getting sessions for all scopes... 2022-12-08 08:56:26.022 [info] Got 0 sessions for ... 2022-12-08 08:56:26.450 [info] Getting sessions for repo,workflow... 2022-12-08 08:56:26.451 [info] Got 0 sessions for repo,workflow... 2022-12-08 08:56:30.850 [info] Logging in for the following scopes: repo workflow 2022-12-08 08:56:30.933 [info] Trying without local server... (repo workflow) 2022-12-08 08:56:30.933 [info] Getting sessions for read:user... 2022-12-08 08:56:30.933 [info] Got 0 sessions for read:user... 2022-12-08 08:56:30.937 [info] Getting sessions for read:user,repo,user:email,workflow... 2022-12-08 08:56:30.937 [info] Got 0 sessions for read:user,repo,user:email,workflow... 2022-12-08 08:56:31.011 [info] Getting sessions for read:user,repo,user:email... 2022-12-08 08:56:31.011 [info] Got 0 sessions for read:user,repo,user:email... 2022-12-08 08:56:31.793 [info] Getting sessions for read:user,repo,user:email,workflow... 2022-12-08 08:56:31.793 [info] Got 0 sessions for read:user,repo,user:email,workflow... 2022-12-08 08:56:33.837 [info] Getting sessions for read:user,repo,user:email,workflow... 2022-12-08 08:56:33.837 [info] Got 0 sessions for read:user,repo,user:email,workflow... 2022-12-08 08:56:33.838 [info] Getting sessions for read:user,repo,user:email... 2022-12-08 08:56:33.838 [info] Got 0 sessions for read:user,repo,user:email... 2022-12-08 08:56:38.610 [info] Exchanging code for token... 2022-12-08 08:56:39.302 [info] Token exchange success! 2022-12-08 08:56:39.304 [info] Getting user info... 2022-12-08 08:56:39.696 [info] Got account info! 2022-12-08 08:56:39.697 [info] Storing 1 sessions... 2022-12-08 08:56:39.864 [info] Reading sessions from keychain... 2022-12-08 08:56:39.864 [info] Stored 1 sessions! 2022-12-08 08:56:39.865 [info] Login success! 2022-12-08 08:56:39.885 [info] Getting sessions for user:email... 2022-12-08 08:56:39.885 [trace] Token acquired from secret storage. 2022-12-08 08:56:39.885 [info] Got stored sessions! 2022-12-08 08:56:39.885 [trace] Read the following session from the keychain with the following scopes: repo workflow 2022-12-08 08:56:39.885 [info] Got 1 verified sessions. 2022-12-08 08:56:39.886 [info] Got 0 sessions for user:email... 2022-12-08 08:56:39.886 [info] Getting sessions for codespace,read:user,repo,user:email... 2022-12-08 08:56:39.886 [info] Got 0 sessions for codespace,read:user,repo,user:email... 2022-12-08 08:56:39.886 [info] Getting sessions for read:user,repo,user:email,workflow... 2022-12-08 08:56:39.886 [info] Got 0 sessions for read:user,repo,user:email,workflow... 2022-12-08 08:56:39.886 [info] Getting sessions for read:user,repo,user:email,workflow... 2022-12-08 08:56:39.886 [info] Got 0 sessions for read:user,repo,user:email,workflow... 2022-12-08 08:56:39.891 [info] Getting sessions for read:user,repo,user:email... 2022-12-08 08:56:39.891 [info] Got 0 sessions for read:user,repo,user:email... 2022-12-08 08:56:40.143 [info] Getting sessions for read:user,repo,user:email,workflow... 2022-12-08 08:56:40.143 [info] Got 0 sessions for read:user,repo,user:email,workflow... 2022-12-08 08:56:40.144 [info] Getting sessions for read:user,repo,user:email... 2022-12-08 08:56:40.144 [info] Got 0 sessions for read:user,repo,user:email... 2022-12-08 08:56:41.842 [info] Getting sessions for read:user... 2022-12-08 08:56:41.842 [info] Got 0 sessions for read:user... 2022-12-08 08:56:43.597 [info] Getting sessions for read:user,repo,user:email,workflow... 2022-12-08 08:56:43.597 [info] Got 0 sessions for read:user,repo,user:email,workflow... 2022-12-08 08:56:43.598 [info] Getting sessions for read:user,repo,user:email... 2022-12-08 08:56:43.598 [info] Got 0 sessions for read:user,repo,user:email... 2022-12-08 08:56:44.303 [info] Logging in for the following scopes: read:user 2022-12-08 08:56:44.303 [info] Trying without local server... (read:user) 2022-12-08 08:56:50.455 [info] Exchanging code for token... 2022-12-08 08:56:50.913 [info] Token exchange success! 2022-12-08 08:56:50.914 [info] Getting user info... 2022-12-08 08:56:51.252 [info] Got account info! 2022-12-08 08:56:51.257 [info] Storing 2 sessions... 2022-12-08 08:56:51.342 [info] Reading sessions from keychain... 2022-12-08 08:56:51.343 [info] Stored 2 sessions! 2022-12-08 08:56:51.343 [info] Login success! 2022-12-08 08:56:51.353 [info] Getting sessions for user:email... 2022-12-08 08:56:51.353 [info] Getting sessions for codespace,read:user,repo,user:email... 2022-12-08 08:56:51.353 [info] Getting sessions for read:user,repo,user:email,workflow... 2022-12-08 08:56:51.354 [info] Getting sessions for read:user,repo,user:email,workflow... 2022-12-08 08:56:51.418 [trace] Token acquired from secret storage. 2022-12-08 08:56:51.419 [info] Got stored sessions! 2022-12-08 08:56:51.419 [trace] Read the following session from the keychain with the following scopes: repo workflow 2022-12-08 08:56:51.419 [trace] Read the following session from the keychain with the following scopes: read:user 2022-12-08 08:56:51.419 [info] Got 2 verified sessions. 2022-12-08 08:56:51.419 [info] Got 0 sessions for user:email... 2022-12-08 08:56:51.419 [info] Got 0 sessions for codespace,read:user,repo,user:email... 2022-12-08 08:56:51.419 [info] Got 0 sessions for read:user,repo,user:email,workflow... 2022-12-08 08:56:51.419 [info] Got 0 sessions for read:user,repo,user:email,workflow... 2022-12-08 08:56:51.420 [info] Getting sessions for read:user,repo,user:email... 2022-12-08 08:56:51.421 [info] Got 0 sessions for read:user,repo,user:email... 2022-12-08 08:56:52.201 [info] Getting sessions for read:user,repo,user:email,workflow... 2022-12-08 08:56:52.201 [info] Got 0 sessions for read:user,repo,user:email,workflow... 2022-12-08 08:56:52.202 [info] Getting sessions for read:user,repo,user:email... 2022-12-08 08:56:52.202 [info] Got 0 sessions for read:user,repo,user:email... 2022-12-08 08:56:55.915 [info] Getting sessions for all scopes... 2022-12-08 08:56:55.915 [info] Got 2 sessions for ... 2022-12-08 08:56:58.424 [info] Logging in for the following scopes: read:user repo user:email 2022-12-08 08:56:58.425 [info] Trying without local server... (read:user repo user:email) 2022-12-08 08:57:02.785 [info] Exchanging code for token... 2022-12-08 08:57:03.292 [info] Token exchange success! 2022-12-08 08:57:03.294 [info] Getting user info... 2022-12-08 08:57:03.630 [info] Got account info! 2022-12-08 08:57:03.631 [info] Storing 3 sessions... 2022-12-08 08:57:03.687 [info] Reading sessions from keychain... 2022-12-08 08:57:03.688 [info] Stored 3 sessions! 2022-12-08 08:57:03.688 [info] Login success! 2022-12-08 08:57:03.693 [info] Getting sessions for user:email... 2022-12-08 08:57:03.693 [info] Getting sessions for codespace,read:user,repo,user:email... 2022-12-08 08:57:03.694 [info] Getting sessions for read:user,repo,user:email,workflow... 2022-12-08 08:57:03.694 [info] Getting sessions for read:user,repo,user:email,workflow... 2022-12-08 08:57:03.695 [trace] Token acquired from secret storage. 2022-12-08 08:57:03.695 [info] Got stored sessions! 2022-12-08 08:57:03.695 [trace] Read the following session from the keychain with the following scopes: repo workflow 2022-12-08 08:57:03.695 [trace] Read the following session from the keychain with the following scopes: read:user 2022-12-08 08:57:03.695 [trace] Read the following session from the keychain with the following scopes: read:user repo user:email 2022-12-08 08:57:03.695 [info] Got 3 verified sessions. 2022-12-08 08:57:03.695 [info] Got 0 sessions for user:email... 2022-12-08 08:57:03.696 [info] Got 0 sessions for codespace,read:user,repo,user:email... 2022-12-08 08:57:03.696 [info] Got 0 sessions for read:user,repo,user:email,workflow... 2022-12-08 08:57:03.696 [info] Got 0 sessions for read:user,repo,user:email,workflow... 2022-12-08 08:57:03.700 [info] Getting sessions for read:user,repo,user:email... 2022-12-08 08:57:03.700 [info] Got 1 sessions for read:user,repo,user:email... 2022-12-08 08:57:35.054 [info] Getting sessions for all scopes... 2022-12-08 08:57:35.054 [info] Got 3 sessions for ... 2022-12-08 08:57:38.437 [info] Getting sessions for user:email... 2022-12-08 08:57:38.438 [info] Got 0 sessions for user:email... 2022-12-08 08:57:40.980 [info] Logging in for the following scopes: user:email 2022-12-08 08:57:40.984 [info] Trying without local server... (user:email) 2022-12-08 08:57:45.308 [info] Exchanging code for token... 2022-12-08 08:57:45.743 [info] Token exchange success! 2022-12-08 08:57:45.744 [info] Getting user info... 2022-12-08 08:57:46.028 [info] Got account info! 2022-12-08 08:57:46.028 [info] Storing 4 sessions... 2022-12-08 08:57:46.084 [info] Reading sessions from keychain... 2022-12-08 08:57:46.084 [info] Stored 4 sessions! 2022-12-08 08:57:46.084 [info] Login success! 2022-12-08 08:57:46.086 [info] Getting sessions for user:email... 2022-12-08 08:57:46.088 [info] Getting sessions for user:email... 2022-12-08 08:57:46.089 [info] Getting sessions for codespace,read:user,repo,user:email... 2022-12-08 08:57:46.089 [info] Getting sessions for read:user,repo,user:email,workflow... 2022-12-08 08:57:46.089 [info] Getting sessions for read:user,repo,user:email,workflow... 2022-12-08 08:57:46.090 [trace] Token acquired from secret storage. 2022-12-08 08:57:46.090 [info] Got stored sessions! 2022-12-08 08:57:46.090 [trace] Read the following session from the keychain with the following scopes: repo workflow 2022-12-08 08:57:46.090 [trace] Read the following session from the keychain with the following scopes: read:user 2022-12-08 08:57:46.090 [trace] Read the following session from the keychain with the following scopes: read:user repo user:email 2022-12-08 08:57:46.090 [trace] Read the following session from the keychain with the following scopes: user:email 2022-12-08 08:57:46.090 [info] Got 4 verified sessions. 2022-12-08 08:57:46.090 [info] Got 1 sessions for user:email... 2022-12-08 08:57:46.090 [info] Got 1 sessions for user:email... 2022-12-08 08:57:46.090 [info] Got 0 sessions for codespace,read:user,repo,user:email... 2022-12-08 08:57:46.090 [info] Got 0 sessions for read:user,repo,user:email,workflow... 2022-12-08 08:57:46.090 [info] Got 0 sessions for read:user,repo,user:email,workflow... 2022-12-08 08:57:46.093 [info] Getting sessions for read:user,repo,user:email... 2022-12-08 08:57:46.093 [info] Got 1 sessions for read:user,repo,user:email... 2022-12-08 08:57:51.772 [info] Getting sessions for all scopes... 2022-12-08 08:57:51.772 [info] Got 4 sessions for ... 2022-12-08 08:59:59.073 [info] Getting sessions for all scopes... 2022-12-08 08:59:59.073 [info] Got 4 sessions for ... 2022-12-08 09:01:54.977 [info] Getting sessions for all scopes... 2022-12-08 09:01:54.978 [info] Got 4 sessions for ... </details<details<summarySystem Info</summary </details<!-- generated by issue reporter --
The issue you hit is that VS Code had issues reading the secrets stored on your machine. This is talking about something different: number of round trips to the browser. I think we are doing what we can to make the round trips as small as possible. This is on GitHub to help us. More here
with the landed, should we close this or morph it into "Reduce GH logins required for multiple extensions"?
Let's close this for now. I don't expect any work on this for the foreseeable future

Discussion:
if (token.expiresIn) { this.setSessionTimeout(token.sessionId, token.refreshToken, scopeData, token.expiresIn * AzureActiveDirectoryService.REFRESH_TIMEOUT_MODIFIER); } <del> await this.setToken(token, scopeData); </del> <ins> this.setToken(token, scopeData); </ins> Logger.info(`Token refresh success for scopes: ${token.scope}`); return token; } catch (e) {

if (token.expiresIn) { this.setSessionTimeout(token.sessionId, token.refreshToken, scopeData, token.expiresIn * AzureActiveDirectoryService.REFRESH_TIMEOUT_MODIFIER); } <del> await this.setToken(token, scopeData); </del> <ins> this.setToken(token, scopeData); </ins> Logger.info(`Login successful for scopes: ${scopeData.scopeStr}`); return await this.convertToSession(token); }

//#region storage operations <del> private async setToken(token: IToken, scopeData: IScopeData): Promise<void> { </del> <ins> private setToken(token: IToken, scopeData: IScopeData): void { </ins> Logger.info(`Setting token for scopes: ${scopeData.scopeStr}`); const existingTokenIndex = this._tokens.findIndex(t => t.sessionId === token.sessionId);

this._tokens.push(token); } <ins> // Don't await because setting the token is only useful for any new windows that open. this.storeToken(token, scopeData); } private async storeToken(token: IToken, scopeData: IScopeData): Promise<void> { if (!vscode.window.state.focused) { const shouldStore = await new Promise((resolve, _) => { // To handle the case where the window is not focused for a long time. We want to store the token // at some point so that the next time they _do_ interact with VS Code, they don't have to sign in again. const timer = setTimeout( () => resolve(true), // 5 hours + random extra 0-30 seconds so that each window doesn't try to store at the same time (18000000) + Math.floor(Math.random() * 30000) ); const dispose = vscode.Disposable.from( vscode.window.onDidChangeWindowState(e => { if (e.focused) { resolve(true); dispose.dispose(); clearTimeout(timer); } }), this._tokenStorage.onDidChangeInOtherWindow(e => { if (e.updated.includes(token.sessionId)) { resolve(false); dispose.dispose(); clearTimeout(timer); } }) ); }); if (!shouldStore) { Logger.info(`Not storing token for scopes ${scopeData.scopeStr} because it was added in another window`); return; } } </ins> await this._tokenStorage.store(token.sessionId, { id: token.sessionId, refreshToken: token.refreshToken, scope: token.scope, account: token.account }); <ins> Logger.info(`Stored token for scopes: ${scopeData.scopeStr}`); </ins> } private async checkForUpdates(e: IDidChangeInOtherWindowEvent<IStoredSession>): Promise<void> { <del> const added: vscode.AuthenticationSession[] = []; const removed: vscode.AuthenticationSession[] = []; </del> for (const key of e.added) { const session = await this._tokenStorage.get(key); if (!session) {

for (const { value } of e.removed) { Logger.info(`Session removed in another window with scopes: ${value.scope}`); <del> const session = await this.removeSessionById(value.id, false); if (session) { removed.push(session); } </del> <ins> await this.removeSessionById(value.id, false); </ins> } <ins> // NOTE: We don't need to handle changed sessions because all that really would give us is a new refresh token // because access tokens are not stored in Secret Storage due to their short lifespan. This new refresh token // is not useful in this window because we really only care about the lifetime of the _access_ token which we // are already managing (see usages of `setSessionTimeout`). </ins> } //#endregion