Skip to main content

Milestone 5.2 — Auth preview and subscriptions

Status: Preview shipped (deployed on ehxlabs.xyz) — anonymous principal + link codes planned for removal in M5.8
Tracking: ehx-kb#12 · Checkout: ehx-web#4

Commits

RepoCommit
ehx-apiadf4f91, a4f1629 (linked browser metadata + unlink)
ehx-weba01c86a, 1083ece (linked browsers UI + link-code UX)
ehx-kbfd9aadd

Shipped

Login-bound principals

PieceBehavior
POST /api/v1/auth/signupCreate account, link browser principal, return session token
POST /api/v1/auth/loginEmail lookup (preview — no password when EHX_AUTH_EMAIL_LOGIN=1)
GET /api/v1/auth/meAccount, linked principals, subscription
POST /api/v1/auth/link-codes8-char code, 15 min (authenticated)
POST /api/v1/auth/link-codes/redeemLink new browser principal to account
POST /api/v1/auth/principals/unlinkRevoke a linked browser principal (cannot unlink current session)
GET /api/v1/auth/me principalsEach linked browser includes browser label, IP, country, user-agent summary, last_seen_at
SessionAuthorization: Bearer or X-Ehx-Session + ehx_session cookie
Web/account/login, session panel on /account, Linked browsers list (unlink), link device panel (Step 1 / Step 2 UX)

Subscriptions (billing preview)

PieceBehavior
subscriptions tableActive plan per account or principal
Checkout confirmUpserts subscription (source: checkout_stub, 30-day period)
Entitlementssubscription beats checkout_stub when resolving tier
Account APIentitlements_source: subscription on plan/dashboard
Metered callsChat, generate, plan, activity, usage banner send Bearer + principal

Cross-device flow (preview — superseded by M5.8)

Planned: Users sign in with Auth0 on each browser. Link codes will be deprecated. See milestone-5-8-auth-required-product.md.

  1. Browser A: checkout confirms → subscription on principal (or account if logged in)
  2. Browser A: sign up at /account/login with email → account + session
  3. Browser A: Generate link code on /account
  4. Browser B: Redeem code → principal linked; subscriptions migrate to account
  5. Browser B: plan/chat use account tier via session token (no second payment)

Try

  1. /checkout → confirm (or simulate) on browser A
  2. /account/login → sign up with email
  3. /account → generate link code
  4. Second browser/incognito → redeem code → /account/plan shows Team tier

Configuration

VariableDefaultNotes
EHX_AUTH_EMAIL_LOGIN1Email-only login (no password)
EHX_DATABASE_URLrequiredPostgres for accounts, sessions, subscriptions

Not yet shipped

  • Passwords, OAuth, email verification
  • Real payment processor / custodial addresses (ehx-web#4)
  • Subscription cancel/renew webhooks
  • Invoice PDFs