oauth
The authorisation-code flow and the system-token exchange.
Begin the authorisation-code flow (E25)
Authenticated by the shell's hatchmate_session cookie (ID-46). The
only operation in the contract that accepts a customer_id from the
client: it runs before any token exists and the choice is checked
against the session's memberships (API-16, API-85). An unknown or
inactive app_slug, or a customer_id the session's user is not a
member of, is 404.
query Parameters
app_slug^[a-z0-9][a-z0-9-]{0… · requiredThe apps registry slug of the target app (TM-61).
customer_idThe customer the user chooses to act as. Validated against the session's memberships; carried only in the token it causes to be minted.
Begin the authorisation-code flow (E25) › Responses
Redirect to a redirect_uri registered on the apps row, carrying
code and state only — never a token (TK-1).
Complete the browser login (E56)
The Keycloak return leg (API-132). Consumes the single-use state,
exchanges code back-channel, creates the hatchmate_session and
redirects into the shell. Every failure of the state, the code
exchange or the subject binding is a 400 that does not say which.
query Parameters
stateThe single-use value issued by E55.
codeThe Keycloak authorisation code. Absent when Keycloak returns error.
errorKeycloak's error code. Its presence is a 400 code-rejected.
error_descriptionKeycloak's error text. Never echoed.
Complete the browser login (E56) › Responses
Redirect into the shell, with the session cookie set.
Begin the browser login (E55)
Starts the shell login (API-132). Generates state, nonce and a PKCE
verifier, persists them (ID-54) and redirects to the Keycloak
authorisation endpoint. Takes no credential and sets no cookie. The
optional return_to is a relative path the shell is sent to after login.
query Parameters
return_to^/($|[^/].*)A relative path beginning / and not //, at most 512 characters.
Defaults to the shell root.
Begin the browser login (E55) › Responses
Redirect to the Keycloak authorisation endpoint.
Exchange an authorisation code for a token (E26)
HTTP Basic client credentials — the apps row's client_id and
client_secret. 401 is byte-identical for an unknown client_id and
a wrong secret. Form encoding is the single exemption from API-49
(API-85, RFC 6749).
Exchange an authorisation code for a token (E26) › Request Body
codecode_verifiergrant_typeredirect_uriExchange an authorisation code for a token (E26) › Responses
An app-facing access token (TK-9).
access_tokenexpires_intoken_type