# Wingman authentication for agents

Wingman uses OAuth 2.1 with PKCE. Every request acts for one signed-in human user. There are no shared API keys and no anonymous write access.

## Endpoints

- Issuer and authorization server metadata: https://flightwingman.com/.well-known/oauth-authorization-server
- Protected resource metadata (MCP): https://mcp.flightwingman.com/.well-known/oauth-protected-resource/mcp
- Dynamic client registration (RFC 7591): `POST https://flightwingman.com/oauth/register`
- Authorization: https://flightwingman.com/oauth/authorize
- Token: https://flightwingman.com/oauth/token
- Revocation: https://flightwingman.com/oauth/revoke

## Register an agent

1. `POST https://flightwingman.com/oauth/register` with `client_name` and `redirect_uris`. The response contains a `client_id`. Clients are public, so use `token_endpoint_auth_method: none`.
2. Send the user to `/oauth/authorize` with `response_type=code`, your `client_id`, `redirect_uri`, `scope=read write`, `code_challenge` (S256 only) and `resource=https://mcp.flightwingman.com/mcp`.
3. The user signs in to Wingman and approves the scopes.
4. Exchange the code at `/oauth/token` with your `code_verifier`. Access tokens last 2 hours. Use the refresh token to renew them.

## Scopes

- `read`: list flights, status, inbound aircraft, connection risk, airport delays, seat maps, stats.
- `write`: add, update, remove and refresh flights, import bookings, change favourite airports. Request it only when needed.

## Use the token

- MCP server: `https://mcp.flightwingman.com/mcp` with `Authorization: Bearer <token>`.
- REST API: `https://flightwingman.com/api/v1` described at https://flightwingman.com/openapi.json.

A missing or invalid token returns `401` with a `WWW-Authenticate` header that points to the protected resource metadata.

## Revoke access

Users can revoke any connected app at https://flightwingman.com/connect or with `DELETE /api/v1/connections/{id}`. Clients can revoke a token at `/oauth/revoke`.

## Agent-ready resources

- https://flightwingman.com/llms.txt
- https://flightwingman.com/.well-known/ai-catalog.json
- https://flightwingman.com/.well-known/mcp.json
- https://flightwingman.com/.well-known/agent-skills/index.json
- https://flightwingman.com/.well-known/search?q={query}
