Auth
Shared identity on Supabase, delivered as Ziteox Account at auth.ziteox.com.
Auth
Purpose
Auth is the shared identity layer for Ziteox apps. It sits on Supabase Auth and is delivered as Ziteox Account at auth.ziteox.com. Apps keep their own data and permissions; Account owns sign-in, memberships, roles, and invites. Staff and clients sign in once, then hand off to the app they need.
Current state
| Surface | Status |
|---|---|
Ziteox Account app (ziteox-auth) | In progress — built in the portal repo; production go-live still gated (awaiting Laki) |
| Admin portal sign-in via Account | In progress — handoff wired in code; not live until gates clear |
| Client portal sign-in via Account | In progress — same handoff pattern; client split in progress |
| Sign-in with Ziteox Account for client Payload CMS admins | Planned — after Account is live and the auth security audit |
| Cloudflare Zero Trust / Access on admin | Planned — phase 2; parked after Account go-live |
What exists in code today
- Account app — portal app
ziteox-auth, OpenNext on Cloudflare Workers. Seeportal: ziteox-auth/CLOUDFLARE.md,portal: ziteox-auth/wrangler.jsonc,portal: ziteox-auth/open-next.config.ts,portal: ziteox-auth/src/middleware.ts, and routes underportal: ziteox-auth/src/app. - Shared package —
portal: packages/auth(@ziteox/auth): handoff helpers, roles, agent identity, Supabase SSR factories. - Admin / client handoff — after Account sign-in, apps exchange a one-time code. Admin:
portal: ziteox-admin/src/app/auth/start/route.ts,portal: ziteox-admin/src/app/auth/handoff/route.ts,portal: ziteox-admin/src/lib/auth-handoff.ts. Client:portal: ziteox-client/src/app/auth/start/route.ts,portal: ziteox-client/src/app/auth/handoff/route.ts. Account token API:portal: ziteox-auth/src/app/api/handoff/token/route.ts. - Roles — apps
admin,client,railwith ranked roles inportal: packages/auth/src/roles/registry.ts. Ceiling rule (nobody grants above their own access):portal: packages/auth/src/roles/ceiling.ts. - Bot / agent identity — tokens prefixed
zxmcp_(portal: packages/auth/src/identity/constants.ts,portal: packages/auth/src/identity/tokens.ts). Owner ceiling for issued permissions:portal: packages/auth/src/identity/ceiling.ts. Device authorization (RFC 8628) in Account:portal: ziteox-auth/src/app/api/device/code/route.ts,portal: ziteox-auth/src/app/api/device/token/route.ts,portal: ziteox-auth/src/app/device/. MCP bearer use on admin lives atportal: ziteox-admin/src/app/api/mcp/route.ts(and relatedmcp-*libs).
Live gates (awaiting Laki)
Nothing below is done in production. Each item waits for Laki (from the Live gates note):
- Migration
190000(must run before admin deploy, or bot keys return 401) - Migration
200000 - Migration
210000 - Hosted Supabase Auth redirect allow-list
- Next.js upgrade to 15.5.28+
- Cloudflare project, DNS, and secrets for Account
- All deploys
Cloudflare Access on admin is parked for phase 2.
Security order
Do this in order. None started. Full write-up: Security roadmap.
- Ziteox Account goes live with admin and client portals
- Security bot audits the auth layer (tokens, session scope, blast radius) — before or alongside Payload CMS Sign-in-with-Ziteox-Account
- Then Cloudflare Zero Trust access control
Interfaces
How a project uses Account today or will use it:
| Kind | What |
|---|---|
| Host | auth.ziteox.com (target; Worker + DNS still gated) |
| Portal app | ziteox-auth |
| Package | @ziteox/auth — handoff, roles, identity, redirects, Supabase helpers |
| Handoff | App starts at /auth/start → Account login → callback /auth/handoff → POST Account /api/handoff/token |
| Device flow | Account /api/device/code, /api/device/token, UI at /device |
| Agent tokens | Prefix zxmcp_; MCP endpoint on admin /api/mcp |
Env var names only (values stay out of Forge; see Account .dev.vars.example and CLOUDFLARE.md):
NEXT_PUBLIC_SUPABASE_URL, NEXT_PUBLIC_SUPABASE_ANON_KEY, SUPABASE_SERVICE_ROLE_KEY, AUTH_APP_URL, NEXT_PUBLIC_AUTH_APP_URL, AUTH_ALLOWED_RETURN_ORIGINS, ADMIN_APP_URL, CLIENT_APP_URL, ZITEOX_AUTH_USE_ACCOUNTS, CF_ACCESS_ENABLED, ZITEOX_HANDOFF_STORE, plus site URL variants listed in portal: ziteox-auth/CLOUDFLARE.md.
Project env vars stay in the admin portal, not in Forge (Env vars boundary note).
Open questions
- When will Laki clear the live gates (migrations, redirect allow-list, Next upgrade, Cloudflare, deploys)?
- Exact production cutover order for admin vs client once gates clear?
- Timing and scope of Sign-in-with-Ziteox-Account for client Payload CMS admins?
- How far bot identity (
zxmcp_, device flow, owner ceiling) should be exposed as a Forge-facing interface vs portal-only?
Also listed on Open questions.
Related
- Systems
- Security roadmap
- Core
- Loom: Ziteox Forge — Auth system · Ziteox Forge — Auth security to-dos (2026-11-01) · Shared Auth Product - auth.ziteox.com · Ziteox Account — MOC (2026-10-29) · Ziteox Account — Client auth split · Ziteox Account — Live gates (awaiting Laki) · Ziteox Shared Platform Vision · Ziteox Forge — Env vars boundary