docs/oauth-e2e-plan.md
mark3labs/mcp-go for mcpproxy, but use go-sdk tests as a primer for expected OAuth flows and fixtures.https://github.com/modelcontextprotocol/go-sdk/blob/main/oauthex/oauth2.go and tests https://github.com/modelcontextprotocol/go-sdk/blob/main/oauthex/oauth2_test.go.https://github.com/modelcontextprotocol/go-sdk/blob/main/oauthex/auth_meta.go, https://github.com/modelcontextprotocol/go-sdk/blob/main/oauthex/resource_meta.go, tests https://github.com/modelcontextprotocol/go-sdk/blob/main/oauthex/auth_meta_test.go.https://github.com/modelcontextprotocol/go-sdk/blob/main/oauthex/dcr.go, tests https://github.com/modelcontextprotocol/go-sdk/blob/main/oauthex/dcr_test.go.https://github.com/modelcontextprotocol/go-sdk/blob/main/oauthex/oauthex.go, tests https://github.com/modelcontextprotocol/go-sdk/blob/main/oauthex/oauthex_test.go, plus https://github.com/modelcontextprotocol/go-sdk/tree/main/oauthex/testdata (auth metadata samples like Google/client-auth).oauthex tests for device grant handling patterns to align our local test server endpoints.auth status / auth login surfaces, doctor checks./.well-known/openid-configuration and /.well-known/oauth-authorization-server (authorization, token, jwks, registration, device endpoints, supported scopes/grants)./authorize accepts PKCE + optional resource; redirects with code + state.authorization_code, refresh_token, client_credentials, urn:ietf:params:oauth:grant-type:device_code; emits JWT access tokens and optional refresh; echo resource into aud./registration issues client_id/client_secret, remembers allowed redirects/scopes./device_authorization + /device_verification with toggles for pending/approved/denied.WWW-Authenticate on protected resource endpoint, discovery-only mode, or explicit endpoints.WWW-Authenticate, from well-known metadata, and from explicit config.resource sent on authorize/token; token carries correct audience; propagated to upstream calls.resource persists on refresh requests and audience in new token.tests/oauthserver exporting Start(t *testing.T, opts Options) returning issuer URL, client creds, JWKS. Options cover flow toggles and error modes.internal/httpapi and internal/runtime using helper to hit real HTTP handlers (server login, callback, token refresh).scripts/run-oauth-e2e.sh): start OAuth server, launch mcpproxy with config pointing at it, run Playwright/API suites for login, device approval, resource handling, DCR./authorize is hit without prompt=none: username/password fields + consent checkbox, with toggles for failure states (bad password, consent denied, MFA placeholder).mcpproxy auth login (or API-triggered login): fill credentials, approve consent, submit, and assert redirect lands on the mcpproxy callback with code/state intact.auth status reflects authenticated state; also assert logs emitted auth URL preview and PKCE/resource parameters.mcpproxy auth status: shows endpoints, scopes, resource, PKCE, expiry, last refresh; masks secrets.mcpproxy auth login: prints authorization URL preview with extra params (resource) before browser open.mcpproxy doctor: OAuth check that validates config, discovery reachability, and emits actionable hints.tests/oauthserver harness with feature toggles and deterministic keys.