fix(opencode): pass OAuth scopes to GoogleAuth for Vertex AI (#15110)

Co-authored-by: Aiden Cline <aidenpcline@gmail.com>
This commit is contained in:
Saurav M H
2026-05-29 05:35:43 +05:30
committed by GitHub
parent acca8864ba
commit 797c689ec2
3 changed files with 16 additions and 11 deletions

View File

@@ -502,9 +502,9 @@ function custom(dep: CustomDep): Record<string, CustomLoader> {
location,
fetch: async (input: RequestInfo | URL, init?: RequestInit) => {
const { GoogleAuth } = await import("google-auth-library")
const auth = new GoogleAuth()
const client = await auth.getApplicationDefault()
const token = await client.credential.getAccessToken()
const auth = new GoogleAuth({ scopes: ["https://www.googleapis.com/auth/cloud-platform"] })
const client = await auth.getClient()
const token = await client.getAccessToken()
const headers = new Headers(init?.headers)
headers.set("Authorization", `Bearer ${token.token}`)