# auth.md — Cerrajeros 24 Horas Las Palmas

You are an AI agent interacting with **Cerrajeros 24 Horas Las Palmas** (`https://cerrajeros24horaslaspalmas.com.es`).

Public informational endpoints (`/api/services.json`, `/api/localities.json`, `/api/status.json`, `/api/openapi.json`, `/mcp` read-only tools, and Markdown page representations via `Accept: text/markdown`) are publicly accessible without authentication. For protected or registered agent workflows, this service publishes standard **OAuth 2.0 / OIDC** and **agentic registration** discovery metadata.

## Step 1 — Discover

Fetch the OAuth Protected Resource Metadata (RFC 9728):

```http
GET https://cerrajeros24horaslaspalmas.com.es/.well-known/oauth-protected-resource
Accept: application/json
```

This document identifies the resource (`https://cerrajeros24horaslaspalmas.com.es`), supported scopes (`read`, `services:read`), and the authorization server (`https://cerrajeros24horaslaspalmas.com.es`).

Next, fetch the OAuth 2.0 Authorization Server Metadata (RFC 8414) containing the `agent_auth` block:

```http
GET https://cerrajeros24horaslaspalmas.com.es/.well-known/oauth-authorization-server
Accept: application/json
```

Alternatively, OIDC clients may query:

```http
GET https://cerrajeros24horaslaspalmas.com.es/.well-known/openid-configuration
Accept: application/json
```

## Step 2 — Register (Agentic Registration)

Agents requesting a client credential or anonymous identity inspect the `agent_auth` block in `/.well-known/oauth-authorization-server`:

- `register_uri`: `https://cerrajeros24horaslaspalmas.com.es/oauth/register`
- `identity_types_supported`: `["identity_assertion", "anonymous"]`
- `claim_uri`: `https://cerrajeros24horaslaspalmas.com.es/oauth/claim`

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

{
  "client_name": "Your Agent Name",
  "grant_types": ["client_credentials"],
  "scope": "read services:read"
}
```

## Step 3 — Claim (Optional Human Verification)

If an anonymous registration returns a `claim_url`, present it to the human operator to associate the agent credential with a verified identity.

## Step 4 — Obtain an Access Token

Exchange credentials at the token endpoint:

```http
POST https://cerrajeros24horaslaspalmas.com.es/oauth/token
Content-Type: application/x-www-form-urlencoded

grant_type=client_credentials&scope=read+services:read
```

## Step 5 — Call APIs & MCP

Pass the bearer token in the `Authorization` header (or access public read-only JSON/MCP endpoints directly):

- API Catalog (RFC 9727): `https://cerrajeros24horaslaspalmas.com.es/.well-known/api-catalog`
- OpenAPI Specification: `https://cerrajeros24horaslaspalmas.com.es/api/openapi.json`
- MCP Server Card: `https://cerrajeros24horaslaspalmas.com.es/.well-known/mcp/server-card.json`
- MCP Endpoint: `https://cerrajeros24horaslaspalmas.com.es/mcp`
- JWKS Public Keys: `https://cerrajeros24horaslaspalmas.com.es/.well-known/jwks.json`

## Step 6 — Revocation

Tokens may be revoked at `https://cerrajeros24horaslaspalmas.com.es/oauth/revoke` following RFC 7009.
