Authentication

Authentication #

Microbooks is a full OAuth 2.0 authorization server, following OAuth 2.1 practice for third-party apps: authorization code with PKCE, rotating refresh tokens, no implicit flow. Every request to the API is authenticated with a bearer token — a signed JWT issued by the auth service and verified by the resource APIs against the platform’s published keys (JWKS).

The password grant is also enabled, but only as the mechanism behind the first-party login endpoint. It is not the path to use for an integration: use a personal access token or the OAuth flow instead.

There are three ways to get a token. Pick the one that matches what you are building:

You are building…UseWhere to start
A script, CI job, or the MCP serverPersonal access tokenPersonal access tokens
An app that accesses other users’ booksAuthorization code + PKCEOAuth flow
A quick experiment against your own accountPassword loginLogin

Scopes #

Tokens carry scopes, and the resource APIs enforce them: GET requests need the :read scope, writes need :write.

ScopeGrants
books:readRead accounting records
books:writeCreate and update accounting records
payments:readRead payment records
payments:writeCreate and update payment records

An account can only grant the scopes it is entitled to — a standard account gets the books:* scopes.

Token lifetimes #

TokenLifetimeNotes
Access token15 minutesSent as Authorization: Bearer <token>
Refresh token30 daysRotates on every use — the old one is revoked when redeemed
Personal access token1 yearLong-lived by design; revoke any you stop using

Because access tokens are short-lived, any long-running integration must either use a personal access token or implement refresh.