> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agentonboard.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# How It Works

> End-to-end request flow, the boundary between identity and permissions, and the zero-consent model.

AgentOnboard lets an AI Agent prove which User it represents without pasting long-lived secrets into prompts or stopping for browser OAuth screens.

***

## Instead of

What AgentOnboard replaces and what each alternative costs:

| Instead of | Tradeoff |
| - | - |
| Raw API key in prompt or config | Leaks into logs, context windows, and shell history, and stays valid until manually revoked. |
| Browser OAuth consent | Blocks autonomous execution whenever a token expires or an agent calls a new app. |
| AgentOnboard | Configure your MCP Client once. The agent mints a 5-minute token per Domain and calls your API directly. |

***

## Request flow

```mermaid theme={null}
sequenceDiagram
    autonumber
    actor Human as User
    participant Agent as AI Agent (Cursor / Claude Code)
    participant MCP as AgentOnboard Remote MCP (/api/mcp)
    participant API as Your App (Backend)
    participant JWKS as Public JWKS (/.well-known/jwks.json)

    Human->>Agent: 1. Configure Remote MCP with aon_live_... key (once)
    Human->>Agent: 2. "Create a note on notes.com"
    Agent->>API: 3. GET https://notes.com/auth.md (discover Domain & endpoints)
    Agent->>MCP: 4. Call get_token(domain: "notes.com")
    MCP-->>Agent: 5. Return 5-minute RS256 Agent Identity Token (aud: "notes.com", email: "ada@example.com")
    Agent->>API: 6. POST /api/notes (Authorization: Bearer <JWT>)
    API->>JWKS: 7. Fetch public keys (cached 1 hour in memory)
    API->>API: 8. Verify RS256 signature, exp, and aud == "notes.com"
    API->>API: 9. Run resolveAccount({ email }) against users table
    API-->>Agent: 10. 200 OK (or 403 ACCOUNT_REQUIRED if unknown)
```

Key properties of this flow:

* **Private keys stay on AgentOnboard.** Your server verifies signatures locally against `https://agentonboard.xyz/.well-known/jwks.json`. AgentOnboard is never in the request path when an agent calls your API.
* **Tokens are bound to your Domain.** The `aud` claim holds your normalized hostname (such as `notes.com`). A token minted for another app fails with `AUDIENCE_MISMATCH`.
* **Tokens expire in 5 minutes.** Each JWT sets `exp = iat + 300`. Serve endpoints over HTTPS and never write raw tokens to logs. See [Token Verification](https://docs.agentonboard.xyz/verify.md#token-anatomy) for the full JWT structure.
* **Verification runs in your process.** `@agentonboard/sdk` depends only on `jose`, and `agentonboard-sdk` in Python depends only on `httpx` and `PyJWT[crypto]`.

***

## Identity vs. permissions

> **AgentOnboard owns identity. Your application owns permissions.**

Verification answers **who the User is** by checking the signature and reading the verified `email` claim. Your backend answers **what they can access** by looking up that email in your database.

Both sides meet in `resolveAccount({ email })`:

* `resolveAccount` receives `{ email }` only. It never receives cookies, IP addresses, or internal AgentOnboard user IDs.
* Returning a user ID or record runs your route handler as that user.
* Returning `null` or `undefined` causes the SDK to return `403 ACCOUNT_REQUIRED`.

***

## Zero-consent model

AgentOnboard does not show per-domain OAuth consent popups. Once a User connects their MCP Client to the [Remote MCP server](https://docs.agentonboard.xyz/api/remote-mcp.md), their agent can mint a 5-minute token for any allowed Domain automatically.

> [!WARNING]
>
> **Your account lookup is the access gate**
>
> Any AgentOnboard User can mint a valid token for your Domain. A valid signature proves the caller controls that email address, so always check the email against your database in `resolveAccount`.

When an unknown email calls your API, you choose one of two paths:

1. **Reject unknown users (Default):** Use `verifyAgentAccount` or `requireAgentAccount`. Unknown emails receive `403 ACCOUNT_REQUIRED`, and your `auth.md` tells the agent where the User can connect or register an App Account.
2. **Allow explicit agent signup:** Keep `verifyAgentAccount` on regular routes, and add one `POST /api/signup` route using `createAgentAccount`. When an agent receives `403 ACCOUNT_REQUIRED`, it calls `/api/signup` and retries its original request. See [Accounts & Agent Signup](https://docs.agentonboard.xyz/accounts.md).

***

## Next steps

> [card] [Quickstart](https://docs.agentonboard.xyz/quickstart.md)
>
> Add agent authentication to Next.js, Express, Hono, FastAPI, Django, or Flask.

> [card] [Token Verification](https://docs.agentonboard.xyz/verify.md)
>
> Install the SDK, inspect the JWT anatomy, and configure verifyAgentToken.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.