summaryrefslogtreecommitdiff
path: root/packages/core/src/code_assist/oauth2.ts
diff options
context:
space:
mode:
authorGal Zahavi <[email protected]>2025-07-25 10:19:38 -0700
committerGitHub <[email protected]>2025-07-25 17:19:38 +0000
commit63214428658da3608180fc07b811e7fd2d143e63 (patch)
tree50563bbe21bc32dd3c97b642188faab8f8d00983 /packages/core/src/code_assist/oauth2.ts
parentfb0db2dfd6ff4150150c2a7b88442da5625cd609 (diff)
feat(auth): Enhance non-interactive gcp auth (#4811)
Diffstat (limited to 'packages/core/src/code_assist/oauth2.ts')
-rw-r--r--packages/core/src/code_assist/oauth2.ts11
1 files changed, 11 insertions, 0 deletions
diff --git a/packages/core/src/code_assist/oauth2.ts b/packages/core/src/code_assist/oauth2.ts
index 5958625a..f1046416 100644
--- a/packages/core/src/code_assist/oauth2.ts
+++ b/packages/core/src/code_assist/oauth2.ts
@@ -78,6 +78,17 @@ export async function getOauthClient(
},
});
+ if (
+ process.env.GOOGLE_GENAI_USE_GCA &&
+ process.env.GOOGLE_CLOUD_ACCESS_TOKEN
+ ) {
+ client.setCredentials({
+ access_token: process.env.GOOGLE_CLOUD_ACCESS_TOKEN,
+ });
+ await fetchAndCacheUserInfo(client);
+ return client;
+ }
+
client.on('tokens', async (tokens: Credentials) => {
await cacheCredentials(tokens);
});