From ebfb1922f5ee1d20e6546ffdad2c7cc3779957fd Mon Sep 17 00:00:00 2001 From: Nate Date: Mon, 7 Jul 2025 22:59:52 -0700 Subject: [PATCH] fix: always refresh with retries Even if an access token is expired, the refresh token could be valid. They don't expire until much longer --- extensions/vscode/src/stubs/WorkOsAuthProvider.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/extensions/vscode/src/stubs/WorkOsAuthProvider.ts b/extensions/vscode/src/stubs/WorkOsAuthProvider.ts index 781a3b633..bdb94129f 100644 --- a/extensions/vscode/src/stubs/WorkOsAuthProvider.ts +++ b/extensions/vscode/src/stubs/WorkOsAuthProvider.ts @@ -198,12 +198,9 @@ export class WorkOsAuthProvider implements AuthenticationProvider, Disposable { const finalSessions = []; for (const session of sessions) { try { - // For expired tokens, don't use retries - if refresh fails, we drop the session - const refreshMethod = this.jwtIsExpiredOrInvalid(session.accessToken) - ? this._refreshSession.bind(this) // Direct refresh for expired tokens - : this._refreshSessionWithRetry.bind(this); // Retry for valid tokens - - const newSession = await refreshMethod(session.refreshToken); + const newSession = await this._refreshSessionWithRetry( + session.refreshToken, + ); finalSessions.push({ ...session, accessToken: newSession.accessToken,