Auth / foldkit-auth

Refusals

Request conditionResponse
No session cookieTreated as visitor (Option.none())
Missing trusted Origin / Sec-Fetch-Site: same-origin (or CSRF header)401, The request did not show it came from this application.
'navigation' on non-GET/HEAD, upgrade, or non-navigate mode401, The request did not show it came from this application.
Cookie expired, signed out, idle, or revoked401, Your session ended.
Multiple session cookies on the request401, Sign in again.
x-foldkit-subject differs from the active session401, Who is signed in changed. (SUBJECT_CHANGED)
Session store error500 defect (never falls back to visitor)

Pages with Referrer-Policy: no-referrer send Origin: null, and same-origin GETs omit Origin; both pass when Sec-Fetch-Site equals same-origin. Browsers send Fetch Metadata only over secure contexts (https: and localhost), so plain http: on remote hosts is refused.

  • Long-lived connections: revalidate re-checks the cookie a live stream or socket opened with. Because Yielded rotates session credentials on renewal, an open socket closes with 4401 (Your session ended.) after renewal so the client reconnects with the new cookie.
  • Session idle timeouts: verifySession checks validity without extending idleTimeout. Call Yielded's renewSession while the user is active, or size idleTimeout to fit your session lifetime.
  • Subject header (x-foldkit-subject): Imported as SUBJECT_HEADER from foldkit-auth (browser-safe, no Yielded import). Holds 'visitor' or 'subject:<key>'. Without key, the resolver compares against session.subjectId.