diegosouzapw/OmniRoute · error

Grok returned an unsupported verification URL

Error message

Grok returned an unsupported verification URL

What it means

validateVerificationUri rejected the device-flow verification URL returned by Grok because its scheme is neither https: nor an http: loopback (localhost/127.0.0.1). This is a security guard: an OAuth redirect over plain non-loopback HTTP could leak the device code. Fires only when the upstream supplies an unexpectedly insecure verification_uri.

Solutions

  1. Treat as an upstream misconfiguration; retry later
  2. Never allowlist the non-https URL manually
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/lib/oauth/providers/grok-cli.ts:86 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/74051d4d6cdb0fbc. Report an issue: GitHub.

Appendix: source

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

    [...value].some((character) => {
      const codePoint = character.codePointAt(0) ?? 0;
      return codePoint <= 0x1f || codePoint === 0x7f;
    })
  ) {
    throw new Error("Grok returned an invalid verification URL");
  }

  let url: URL;
  try {
    url = new URL(value);
  } catch {
    throw new Error("Grok returned an invalid verification URL");
  }

  const isLocalHttp =
    url.protocol === "http:" && (url.hostname === "localhost" || url.hostname === "127.0.0.1");
  if (url.protocol !== "https:" && !isLocalHttp) {
    throw new Error("Grok returned an unsupported verification URL");
  }
}

/**
 * Device-code flow (#7358). Kept alongside the browser PKCE flow below (#7013
 * rework) — see grokCli.flowType, which stays "device_code" so it remains the
 * primary/default experience in OAuthModal.tsx and the route.ts device-code
 * action family.
 *
 * `grokCli.config` below is GROK_BUILD_OAUTH_CONFIG (the browser-PKCE shape —
 * required so it stays reference-equal for oauth-providers-config.test.ts and
 * so buildAuthUrl/exchangeToken keep receiving the right config). The
 * device-code endpoints and scope live on a DIFFERENT config (GROK_CLI_CONFIG:
 * deviceCodeUrl + a wider legacy scope set) that has no `authorizeUrl`/
 * `loopbackPort` shape, so requestDeviceCode/pollToken intentionally ignore
 * whatever config providers.ts passes them and always read GROK_CLI_CONFIG
 * directly.
 */

View on GitHub (pinned to a179ffed5b)