File tree Expand file tree Collapse file tree 3 files changed +13
-10
lines changed Expand file tree Collapse file tree 3 files changed +13
-10
lines changed Original file line number Diff line number Diff line change @@ -481,7 +481,17 @@ export class Commands {
481481 throw new Error ( "You are not logged in" ) ;
482482 }
483483
484+ await this . forceLogout ( ) ;
485+ }
486+
487+ public async forceLogout ( ) : Promise < void > {
488+ if ( ! this . contextManager . get ( "coder.authenticated" ) ) {
489+ return ;
490+ }
491+ this . logger . info ( "Logging out" ) ;
492+
484493 // Check if using OAuth
494+ // TODO maybe just add this check inside oauthSessionManager
485495 const hasOAuthTokens = await this . secretsManager . getOAuthTokens ( ) ;
486496 if ( hasOAuthTokens ) {
487497 this . logger . info ( "Logging out via OAuth" ) ;
@@ -495,15 +505,6 @@ export class Commands {
495505 }
496506 }
497507
498- // Continue with standard logout (clears sessionToken, contexts, etc)
499- await this . forceLogout ( ) ;
500- }
501-
502- public async forceLogout ( ) : Promise < void > {
503- if ( ! this . contextManager . get ( "coder.authenticated" ) ) {
504- return ;
505- }
506- this . logger . info ( "Logging out" ) ;
507508 // Clear from the REST client. An empty url will indicate to other parts of
508509 // the code that we are logged out.
509510 this . restClient . setHost ( "" ) ;
Original file line number Diff line number Diff line change @@ -146,7 +146,7 @@ export async function activate(ctx: vscode.ExtensionContext): Promise<void> {
146146 const url = mementoManager . getUrl ( ) ;
147147 if ( url ) {
148148 const cliManager = serviceContainer . getCliManager ( ) ;
149- // TODO label might not match?
149+ // TODO label might not match the one in remote ?
150150 await cliManager . configure ( toSafeHost ( url ) , url , token ) ;
151151 output . debug ( "Updated CLI config with new token" ) ;
152152 }
Original file line number Diff line number Diff line change @@ -382,6 +382,8 @@ export class OAuthSessionManager implements vscode.Disposable {
382382 /**
383383 * Handle OAuth callback from browser redirect.
384384 * Validates state and resolves pending authorization promise.
385+ *
386+ * // TODO this has to work across windows!
385387 */
386388 handleCallback (
387389 code : string | null ,
You can’t perform that action at this time.
0 commit comments