Authentication
You sign in to the core API and get a session cookie. To call the ticketing API, you trade that session for a token that is valid for 5 minutes.
1. Sign in to core
Core (https://api.matbucks.info) keeps the session in a cookie. Sign-in and the rest of the account routes are under /api/auth/*. For example:
curl -c jar.txt https://api.matbucks.info/api/auth/sign-in/email \
-H 'Origin: https://matbucks.info' \
-H 'Content-Type: application/json' \
-d '{"email":"you@example.com","password":"…"}'
- Send the cookie jar back on every call to core. The cookie belongs to
api.only. It is not shared with other subdomains. - Send an
Originheader. Without one, a state-changing request with a session cookie is refused (403 MISSING_OR_NULL_ORIGIN). Browsers send it for you; native apps must set it. - Send
{}, not an empty body, on a JSON POST that has no fields. - Errors under
/api/auth/*have a different shape. They are{ "code", "message" }with noerrorwrapper and norequestId. Everything under/api/v1/*uses the platform error shape.
2. Get a ticketing token
Call GET /api/auth/token on core, with the session cookie and an Origin:
curl -b jar.txt https://api.matbucks.info/api/auth/token \
-H 'Origin: https://matbucks.info'
{ "token": "eyJhbGciOiJFZERTQSIs…" }
Without a session the answer is 401. An account with no date of birth on file gets 403 DATE_OF_BIRTH_REQUIRED.
What is in the token
A JWT signed with Ed25519 (alg is EdDSA). It contains these claims and nothing else:
| Claim | Meaning |
|---|---|
sub | The user id. |
sid | The session the token was minted from. |
aud | Always tickets-api. |
iss | Core's origin. |
iat, exp | Issued at, and 5 minutes later. |
tfa | Whether the account had a verified second factor when the token was minted. |
The token carries no email, name, phone number or permissions. The ticketing service checks what you are allowed to do on every request, from its own records.
3. Call ticketing with the token
Send the token as a bearer on every call to https://tickets-api.matbucks.info:
curl https://tickets-api.matbucks.info/api/v1/… \
-H 'Authorization: Bearer eyJhbGciOiJFZERTQSIs…'
- Bearer only. The ticketing API never reads or sets a cookie.
- Keep the token in memory. Do not put it in
localStorageor a cookie. - Refresh it about 60 seconds before
expby callingGET /api/auth/tokenagain. On a401, get a new token and retry once. - A
503 SERVICE_UNAVAILABLE("Sign-in service unavailable") means ticketing cannot reach core's keys right now. A new token will not help, so do not retry in a loop.
How ticketing checks the token
Ticketing fetches core's public keys from GET https://api.matbucks.info/api/auth/jwks and caches them. It fetches them again when a token names a key it does not know. It checks the signature, iss, aud, that alg is EdDSA, and exp with 5 seconds of tolerance. A key signs for 90 days. Its public half stays in the JWKS for one day after that.
A revoked session stops minting tokens when its cookie stops working. A token already issued still works until its exp, at most 5 minutes later.