From 6505b0c8e16f876ba7ca80b19aa3893dc858ce59 Mon Sep 17 00:00:00 2001 From: Arya Gummadi Date: Tue, 19 Aug 2025 17:06:25 -0700 Subject: fix: allow re-auth with another google account (#6544) --- packages/core/src/code_assist/oauth2.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'packages/core/src/code_assist/oauth2.ts') diff --git a/packages/core/src/code_assist/oauth2.ts b/packages/core/src/code_assist/oauth2.ts index f479dd1b..38238b0b 100644 --- a/packages/core/src/code_assist/oauth2.ts +++ b/packages/core/src/code_assist/oauth2.ts @@ -391,13 +391,19 @@ function getCachedCredentialPath(): string { return path.join(os.homedir(), GEMINI_DIR, CREDENTIAL_FILENAME); } +export function clearOauthClientCache() { + oauthClientPromises.clear(); +} + export async function clearCachedCredentialFile() { try { await fs.rm(getCachedCredentialPath(), { force: true }); // Clear the Google Account ID cache when credentials are cleared await clearCachedGoogleAccount(); - } catch (_) { - /* empty */ + // Clear the in-memory OAuth client cache to force re-authentication + clearOauthClientCache(); + } catch (e) { + console.error('Failed to clear cached credentials:', e); } } -- cgit v1.2.3