summaryrefslogtreecommitdiff
path: root/packages/core/src/code_assist/oauth2.ts
diff options
context:
space:
mode:
authorArya Gummadi <[email protected]>2025-08-19 17:06:25 -0700
committerGitHub <[email protected]>2025-08-20 00:06:25 +0000
commit6505b0c8e16f876ba7ca80b19aa3893dc858ce59 (patch)
tree10ebc3b512a3366a2e92eef07db6fc92ac922f60 /packages/core/src/code_assist/oauth2.ts
parent389102ec0e6370c29df6499157417861f8c1c253 (diff)
fix: allow re-auth with another google account (#6544)
Diffstat (limited to 'packages/core/src/code_assist/oauth2.ts')
-rw-r--r--packages/core/src/code_assist/oauth2.ts10
1 files changed, 8 insertions, 2 deletions
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);
}
}