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":"[email protected]","password":"…"}'

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:

ClaimMeaning
subThe user id.
sidThe session the token was minted from.
audAlways tickets-api.
issCore's origin.
iat, expIssued at, and 5 minutes later.
tfaWhether 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…'

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.