oauth/v1

An OAuth 2.1 authorization server for the app: authorization code with PKCE, device code, refresh, revocation, and client registration (dynamic, or by a client metadata document). The CLI's browser login and MCP clients such as Claude sign in through it, and get API tokens (api-tokens/v1).

A routed contract (oauth.go): the OAuth specs fix its API's shape, so its provider serves it as it is.

Use

HTTP What it does
GET /.well-known/oauth-authorization-server the server's metadata (RFC 8414 puts it at the root)
GET / POST /api/_c/oauth/v1/authorize sign in and consent (browser)
POST /api/_c/oauth/v1/token codes and refresh tokens for access tokens
POST /api/_c/oauth/v1/device start a device-code sign-in
GET / POST /api/_c/oauth/v1/device/verify enter the device code (browser)
POST /api/_c/oauth/v1/revoke revoke a token
POST /api/_c/oauth/v1/register dynamic client registration (when on)
GET / POST /api/_c/oauth/v1/provider/callback sign-in through an OAuth2 provider (Google, Apple, ...)

authorize and device take an optional account: the auth collection the client needs the token from (the CLI sends _superusers). The sign-in shows only that form, and no other collection is issued a token.

In Go, another extension (MCP) turns on dynamic registration and sets token lifetimes: oauthv1.Contract.Of(app) → EnableDynamicRegistration(), SetAccessTTL(path, ttl), Issuer(e).

Provide

Implement oauthv1.Server and serve the routes above (extkit.EventServer or extkit.RouteBinder); issue access tokens through api-tokens/v1.

Commands and APIs

Its own HTTP API under /api/_c/oauth/v1/, described above. It has no generated commands or MCP tools. Remote CLI explains how PocketOne apps are managed from afar.

Extensions

Extension
api-tokens provides
mcp works with

License

MIT