# auth.md

You are an agent. This origin is a **public professional portfolio**. Discovery, profile data, projects, and the contact API do not require an access token. Follow the steps in order: discover → register (anonymous) → claim (optional, no-op) → call the API → handle revocation.

## Step 1 — Discover

Discovery is two hops.

```http
HTTP/1.1 200 OK
WWW-Authenticate: Bearer realm="https://sebastianalcaraz.com/", resource_metadata="https://sebastianalcaraz.com/.well-known/oauth-protected-resource"
```

### 1a. Fetch the Protected Resource Metadata

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

```json
{
  "resource": "https://sebastianalcaraz.com/",
  "resource_name": "Sebastian Alcaraz Portfolio",
  "authorization_servers": ["https://sebastianalcaraz.com/"],
  "scopes_supported": ["public"],
  "bearer_methods_supported": ["header"]
}
```

### 1b. Fetch the Authorization Server metadata

```http
GET https://sebastianalcaraz.com/.well-known/oauth-authorization-server
```

```json
{
  "issuer": "https://sebastianalcaraz.com",
  "token_endpoint": "https://sebastianalcaraz.com/oauth/token",
  "revocation_endpoint": "https://sebastianalcaraz.com/oauth/revoke",
  "grant_types_supported": [
    "urn:ietf:params:oauth:grant-type:jwt-bearer",
    "urn:workos:agent-auth:grant-type:claim"
  ],
  "agent_auth": {
    "skill": "https://sebastianalcaraz.com/auth.md",
    "register_uri": "https://sebastianalcaraz.com/oauth/register",
    "claim_uri": "https://sebastianalcaraz.com/oauth/claim",
    "revocation_uri": "https://sebastianalcaraz.com/oauth/revoke",
    "identity_types_supported": ["anonymous"],
    "anonymous": {
      "credential_types_supported": ["none"]
    }
  }
}
```

Read `agent_auth.register_uri`, `agent_auth.claim_uri`, `identity_types_supported`, and `anonymous.credential_types_supported`. The only supported identity type is `anonymous`. The only credential type is `none`.

## Step 2 — Pick a method

Use this decision tree:

1. **You have neither a user identity nor an ID-JAG** → [anonymous](#anonymous). This origin only supports anonymous public access.

## Step 3 — Register

### anonymous

```http
POST https://sebastianalcaraz.com/oauth/register
Content-Type: application/json

{
  "type": "anonymous",
  "identity_type": "anonymous",
  "requested_credential_type": "none"
}
```

The response confirms public access. **No credential is issued.** Do not send an Authorization header.

## Step 4 — Claim ceremony

Optional. Anonymous access is already public; claiming does not upgrade scopes.

```http
POST https://sebastianalcaraz.com/oauth/claim
Content-Type: application/json

{ "type": "anonymous" }
```

`claim_uri` is `https://sebastianalcaraz.com/oauth/claim`. The response reports that no claim ceremony is required.

## Step 5 — Call the API

```http
POST https://sebastianalcaraz.com/api/contact
Content-Type: application/json

{
  "name": "Ada Lovelace",
  "email": "ada@example.com",
  "message": "We would like to discuss a PrestaShop integration."
}
```

Limits: name ≤ 100 chars, email ≤ 254, message ≤ 2000. Rate limit: 5 requests / minute / IP. Include a real reply-to email.

MCP tools are advertised at `/.well-known/mcp/server-card.json`.

## Errors

| Code | Where | What to do |
| --- | --- | --- |
| `invalid_request` | `/oauth/token` | Do not request a token. Call public APIs without Authorization. |
| `anonymous_not_enabled` | `/oauth/register` | This origin only accepts anonymous. |
| `rate_limited` (429) | `/api/contact` | Back off and retry. |

## Revocation

There are no issued agent credentials, so there is nothing to revoke. `POST https://sebastianalcaraz.com/oauth/revoke` returns that status. `revocation_uri` is `https://sebastianalcaraz.com/oauth/revoke`.
