# Authentication for agents: Perla (Extraordinaire Work)

An agent acts for one person. The person always signs in themselves; an agent never holds their password.

## Discover
- MCP endpoint: https://work.extraordinaire.ai/mcp (Streamable HTTP). Without a credential it answers `401` with `WWW-Authenticate: Bearer resource_metadata="https://work.extraordinaire.ai/.well-known/oauth-protected-resource/mcp"`.
- Protected resource metadata (RFC 9728): https://work.extraordinaire.ai/.well-known/oauth-protected-resource/mcp
- Authorization server metadata (RFC 8414): https://work.extraordinaire.ai/.well-known/oauth-authorization-server
- There is no `agent_auth` block, no `identity_endpoint` and no ID-JAG (`identity_assertion`, `service_auth`) exchange: every grant starts with the person.

## Pick a method
- **MCP clients:** OAuth 2.1, authorization code with PKCE (S256). Recommended.
- **REST clients:** a personal key the person creates at https://work.extraordinaire.ai/#/connect, sent as `Authorization: Bearer <key>` to https://work.extraordinaire.ai/api/v1.
- **No account yet:** the keyless sandbox (POST https://work.extraordinaire.ai/api/v1/sandbox/requests) and the A2A agent (https://work.extraordinaire.ai/.well-known/agent-card.json). Nothing is saved.

## Register
Clients identify themselves with a Client ID Metadata Document (`client_id_metadata_document_supported`): the `client_id` is the HTTPS address of your client's metadata. No dynamic registration call is needed.

## Claim
The person opens the authorization URL, signs in to Perla (early access, by invitation) and chooses what the agent may do: the side (getting help, contributing or both) and the scopes.

## Exchange
Exchange the authorization code at the token endpoint with your PKCE `code_verifier`. The token is issued for the resource https://work.extraordinaire.ai/mcp only (RFC 8707) and is refused by the REST API.

## Use the access_token
Send `Authorization: Bearer <access_token>` to https://work.extraordinaire.ai/mcp. Call `whoami` first. Scopes are listed in the metadata (for example `requests:read`, `requests:write`, `results:read`).

## Errors
- `401` with `WWW-Authenticate`: refresh the token or sign in again.
- `403`: the person did not allow this; the answer says what to ask them. Approving, paying and accepting are never allowed to an agent.
- `429` with `Retry-After`: 60 reads and 10 changes a minute per credential.

## Revocation
The person disconnects an assistant or deletes a key at https://work.extraordinaire.ai/#/connect; it stops working at once.
