# auth.md

You are an agent. Logsblox supports agent registration through OAuth 2.1 dynamic client registration and a human claim step. Discover the resource, register a client, send the user to claim the account if needed, then call the APIs with a bearer token.

Logsblox is for developers who need immutable, tamper-evident application logs. Humans use the app at `https://app.logsblox.com`. Agents use ingest and MCP.

## Audience

- **Humans** create or sign in to a Logsblox account at `https://app.logsblox.com/auth`
- **Agents** register an OAuth client, complete the authorization-code flow, and call MCP
- **Collectors** send OpenTelemetry logs to ingest with a project API key (`x-api-key`)

## Step 1 — Discover

### Protected Resource Metadata

```http
GET https://logsblox.com/.well-known/oauth-protected-resource
```

MCP also publishes its own document:

```http
GET https://mcp.logsblox.com/.well-known/oauth-protected-resource
```

Use the `authorization_servers` issuer from that document. Send access tokens as `Authorization: Bearer …` (`bearer_methods_supported` includes `header`).

### Authorization Server Metadata

```http
GET https://api.logsblox.com/auth/v1/.well-known/oauth-authorization-server
```

The same metadata is mirrored at `https://logsblox.com/.well-known/oauth-authorization-server` for origin discovery. The `issuer` is `https://api.logsblox.com/auth/v1`.

Personal Agent Protocol discovery is `https://logsblox.com/.well-known/poppy.json`. Its `auth.issuer` is `https://logsblox.com/poppy`. RFC 8414 metadata for that issuer is `https://logsblox.com/.well-known/oauth-authorization-server/poppy`.

The `agent_auth` block advertises:

- `skill`: `https://logsblox.com/auth.md`
- `register_uri`: `https://api.logsblox.com/auth/v1/oauth/clients/register`
- `identity_types_supported`: `anonymous`
- `anonymous.claim_uri`: `https://app.logsblox.com/auth`

## Step 2 — Register

Register an OAuth client at the `register_uri` (RFC 7591):

```http
POST https://api.logsblox.com/auth/v1/oauth/clients/register
Content-Type: application/json
```

Supported identity type today: **anonymous** OAuth client credentials, then a human claim/sign-in at `https://app.logsblox.com/auth` when a user account is required. Logsblox does not yet accept ID-JAG identity assertions.

Do not `POST /agent/auth` — that path is not provisioned.

## Step 3 — Authorize

Use the authorization-code flow with PKCE.

- `authorization_endpoint`: `https://api.logsblox.com/auth/v1/oauth/authorize`
- Consent UI: `https://app.logsblox.com/oauth/consent`
- `token_endpoint`: `https://api.logsblox.com/auth/v1/oauth/token`
- `jwks_uri`: `https://api.logsblox.com/auth/v1/.well-known/jwks.json`
- Grant types: `authorization_code`, `refresh_token`
- Response type: `code`

If the user does not have an account, send them to `https://app.logsblox.com/auth?mode=signup`.

## Step 4 — Call APIs

### MCP

`https://mcp.logsblox.com` — Streamable HTTP. Tools: `list_projects`, `project_info`, `summarize_logs`, `top_log_patterns`, `search_logs`, `list_recent_errors`.

### Ingest

`POST https://ingest.logsblox.com/` with `x-api-key` and an OTLP logs payload. See `https://logsblox.com/docs/api.md`.

## Scopes

`openid`, `profile`, `email`, `offline_access`
