Cookie scopes
Implemented in
lib/supabase/auth-scope.ts.
Operator flow (production)
- Open
/admin/login. - Enter your Envato/CodeCanyon purchase code (verified with
ENVATO_PERSONAL_TOKENin production). Optional: restrict to one item withENVATO_ITEM_ID. - Streamly sends a magic-link email via Resend (
RESEND_API_KEY+STREAMLY_FROM_EMAIL). - If the account is unverified, the operator is sent to
/verify-emailuntil verification completes. - After success →
/admin/overview(or/admin/onboardingwhen required).
Demo license (sandbox only)
WhenENABLE_DEMO=true or ADMIN_ALLOW_DEMO_LICENSE is set:
Turn demo flags off on production buyer installs.
Viewer flow
- Viewer opens
/loginor/signup. - Supabase issues a session stored in the viewer cookie jar.
/auth/callbackcompletes OAuth / magic-link style redirects when used.- Middleware may require a Who’s Watching profile (
/profiles) before gated routes. /moviesand/showsrequire authentication.
demo@streamly.watch / demo123456 — not the operator account.
Refresh
/api/auth/refresh renews sessions. Middleware stays intentionally small for Cloudflare Worker size limits.
Landing helpers: /api/landing/session, /api/landing/logout.