diegosouzapw/OmniRoute · error

Grok Build token exchange failed: ${error}

Error message

Grok Build token exchange failed: ${error}

What it means

Error "Grok Build token exchange failed: ${error}" thrown in diegosouzapw/OmniRoute.

Source

Thrown at src/lib/oauth/providers/grok-cli-oauth.ts:61

): Promise<Record<string, unknown>> {
  const response = await fetch(config.tokenUrl, {
    method: "POST",
    headers: {
      "Content-Type": "application/x-www-form-urlencoded",
      Accept: "application/json",
    },
    body: new URLSearchParams({
      grant_type: "authorization_code",
      client_id: config.clientId,
      code,
      redirect_uri: redirectUri,
      code_verifier: codeVerifier,
    }),
  });

  if (!response.ok) {
    const error = await response.text();
    throw new Error(`Grok Build token exchange failed: ${error}`);
  }

  return response.json();
}

/**
 * Detect an OAuth token-endpoint response (browser PKCE exchange output),
 * which uses snake_case `access_token`, as opposed to the paste-token import
 * shape (`{ accessToken: <JWT string or auth.json blob> }`).
 */
export function isGrokBuildBrowserTokens(tokens: unknown): tokens is Record<string, unknown> {
  return (
    !!tokens &&
    typeof tokens === "object" &&
    typeof (tokens as Record<string, unknown>).access_token === "string"
  );
}

View on GitHub (pinned to a179ffed5b)

When it happens

Trigger: Thrown at src/lib/oauth/providers/grok-cli-oauth.ts:61 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of diegosouzapw/OmniRoute@a179ffed5b (2026-08-25). Data as JSON: /api/errors/8a52e54cccc65357. Report an issue: GitHub.