fix(grok): route OAuth subscriptions through CLI proxy

This commit is contained in:
Heatherm Huang committed 2026-07-13 10:11:33 +08:00
1 parent d9e466ad3a
commit 3375b4ed2b
10 files changed
+115 -9

No files matched your search

@@ -53,3 +53,20 @@ describe('useGrokOAuth.exchangeAuthCode', () => {
)
})
})
describe('useGrokOAuth.buildCredentials', () => {
it('persists the Grok CLI subscription proxy for OAuth inference', () => {
const oauth = useGrokOAuth()
const credentials = oauth.buildCredentials({
access_token: 'access-token',
token_type: 'Bearer',
expires_at: 1_900_000_000,
client_id: 'client-id',
scope: 'openid grok-cli:access',
email: 'grok@example.com'
})
expect(credentials.base_url).toBe('https://cli-chat-proxy.grok.com/v1')
})
})
+2 -1
View File
@@ -122,7 +122,8 @@ export function useGrokOAuth() {
scope: tokenInfo.scope,
email: tokenInfo.email,
subscription_tier: tokenInfo.subscription_tier,
entitlement_status: tokenInfo.entitlement_status
entitlement_status: tokenInfo.entitlement_status,
base_url: 'https://cli-chat-proxy.grok.com/v1'
}
if (tokenInfo.refresh_token) credentials.refresh_token = tokenInfo.refresh_token
if (tokenInfo.id_token) credentials.id_token = tokenInfo.id_token