summaryrefslogtreecommitdiff
path: root/packages/core/src/code_assist/oauth2.ts
diff options
context:
space:
mode:
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);
}
}