Skip to main content
Last updated on
Advanced — 0.0.x primitives

You don't need this page for a normal integration. Use the quickstarts and createMythos() instead. These low-level functions remain exported for custom setups.

requireLaunchToken

Express middleware that verifies a launch token and calls Mythos /consume.

Signature​

typescript
function requireLaunchToken(options?: {
resolveListingIds?: () => Promise<string[]>;
}): RequestHandler

Parameters​

OptionTypeRequiredDescription
resolveListingIds() => Promise<string[]>NoAdditional listing IDs from dynamic registration

Reads lt from req.query.

Behavior​

  1. Reject if lt missing → 401
  2. Call verifyLaunchToken(token, options) → 401 on failure
  3. Call POST /api/apps/sessions/{jti}/consume → 503 on network error, 401 on 409 replay
  4. Set req.mythos and call next()

Responses​

StatusBody
200(via next()) — attach session in route handler
401{ "error": "Missing launch token" }
401{ "error": "Invalid launch token" }
401{ "error": "Token already consumed" }
503{ "error": "Could not verify session" }

Example​

typescript
app.get('/api/mythos/session', requireLaunchToken(), (req, res) => {
res.json({ ok: true, session: req.mythos });
});

See also​