fix(oauth): align antigravity OAuth metadata with official client headers

Fixes #1226

The Antigravity OAuth flow sent inconsistent client metadata between
the token acquisition phase and the API usage phase. String enum values
(IDE_UNSPECIFIED, PLATFORM_UNSPECIFIED) were used during OAuth token
exchange + loadCodeAssist + onboardUser, while numeric enums (ideType: 9,
platform: <computed>, pluginType: 2) were used in runtime API calls.
Google detected this fingerprint mismatch and blocked 9router accounts.

Replace all string enum occurrences with the correct numeric values:

- src/lib/oauth/constants/oauth.js: loadCodeAssistClientMetadata now
  uses getOAuthPlatformEnum() for platform and numeric 9/2 for
  ideType/pluginType, matching getOAuthClientMetadata()
- src/lib/oauth/services/antigravity.js: getMetadata() now delegates
  to getOAuthClientMetadata() instead of returning hardcoded strings
- src/lib/oauth/providers.js: postExchange metadata now uses
  getOAuthClientMetadata() instead of inline string enums
- open-sse/services/usage.js: getGeminiSubscriptionInfo body now uses
  CLIENT_METADATA (already imported from appConstants.js) instead of
  inline string enums
This commit is contained in:
Z User authored and decolua committed 2026-05-18 15:23:37 +07:00
1 parent 5e1c126136
commit 8daa953ef6
4 files changed
+9 -16

No files matched your search

+2 -2
View File
@@ -108,8 +108,8 @@ export const ANTIGRAVITY_CONFIG = {
onboardUserEndpoint: "https://cloudcode-pa.googleapis.com/v1internal:onboardUser",
loadCodeAssistUserAgent: "google-api-nodejs-client/9.15.1",
loadCodeAssistApiClient: "google-cloud-sdk vscode_cloudshelleditor/0.1",
// String enum matches CLIProxyAPI Go source (internal/auth/antigravity/constants.go)
loadCodeAssistClientMetadata: JSON.stringify({ ideType: "IDE_UNSPECIFIED", platform: "PLATFORM_UNSPECIFIED", pluginType: "GEMINI" }),
// Numeric enums matching Antigravity binary ClientMetadata (see getOAuthClientMetadata below)
loadCodeAssistClientMetadata: JSON.stringify({ ideType: 9, platform: getOAuthPlatformEnum(), pluginType: 2 }),
};
/**