NousResearch/hermes-agent · error · Error

OAuth authorization failed

Error message

OAuth authorization failed

What it means

While polling the OAuth flow status (1s interval, up to maxPollFailures network errors tolerated), the backend reported `{status: 'error'}` with an empty error field, so the client falls back to this generic 'authorization failed' text. It means the flow genuinely failed server-side — not a network blip (those retry) — such as the provider rejecting the token exchange.

Source

Thrown at web/src/lib/mcp-dashboard-oauth.ts:59

    authWindow.close();
    throw error;
  }

  let pollFailures = 0;
  for (;;) {
    let current: McpOAuthFlow;
    try {
      current = await status(started.flow_id);
      pollFailures = 0;
    } catch (error) {
      pollFailures += 1;
      if (pollFailures >= maxPollFailures) throw error;
      await sleep(1000);
      continue;
    }
    if (current.status === "approved") return current;
    if (current.status === "error") {
      throw new Error(current.error || "OAuth authorization failed");
    }
    if (authWindow.closed) {
      throw new Error("OAuth authorization window was closed before completion");
    }
    await sleep(1000);
  }
}

View on GitHub (pinned to c896c09c42)

Solutions

  1. Check the gateway logs for the flow_id — the recorded server-side error explains the failure that the status payload omitted.
  2. Verify the OAuth client configuration (client_id/secret, redirect URI, scopes) for the MCP server.
  3. Retry the flow after fixing config; each retry mints a new flow_id and popup.
Defensive patterns

Strategy: retry

Try / catch

try {
  const flow = await completeMcpDashboardOAuth({ serverName, start, status, open })
} catch (err) {
  if (/authorization failed/i.test(String(err))) {
    toast('OAuth was rejected — verify client id/secret and redirect URI, then retry')
    return
  }
  throw err
}

Prevention

When it happens

Trigger: The user completes or abandons consent and the provider returns an error to the callback; the code/token exchange at the gateway fails (bad client_secret, redirect_uri mismatch); or the flow times out server-side and is marked errored.

Common situations: Wrong OAuth client secret or redirect URI configured on the gateway; the provider's app not approved for the scopes; users pasting the dashboard behind a proxy that mangles the redirect.

Related errors


AI-assisted analysis of NousResearch/hermes-agent@c896c09c42 (2026-08-14). Data as JSON: /api/errors/cfbb379cebfdd574. Report an issue: GitHub.