Authentication and roles
Supabase Auth for verified identity. Database policies for real permissions.
Public preview and demo login
Mock mode provides admin@kite.dev / password, shown
beside the prefilled fields. It sends no mail and never grants backend access.
The public preview opens the dashboard immediately; sign out to view its form.
Production fields start empty and offer a separate demo link, configured with
KITE_PREVIEW_URL (an empty value hides it).
Local end-to-end tests
The repository includes a local kite-e2e Supabase stack with email confirmation enabled. API: 57421; Mailpit: 57424. No messages leave the machine.
node tools/local-supabase.mjs start
node tools/configure-local-supabase.mjs
node tools/auth-e2e.mjs
The live-service runner tests confirmation, password sign-in, PKCE recovery, Viewer/Editor/Admin permissions, self-escalation prevention, immediate revocation, and refresh-token invalidation. It rejects hosted endpoints and removes synthetic fixtures. CI runs it against a fresh local stack.
Production setup
- Apply
supabase/migrations/202610270001_kite_auth_roles.sqlto a new project. - Configure email/password Auth, SMTP, email confirmation and password policies.
- Allow your exact
/auth/callbackURL and its?flow=recoveryvariant in Supabase. - Copy
config/production.example.jsontoconfig/production.local.jsonand set the public project configuration. - Assign the initial administrator through the SQL editor. New signups receive no resource access automatically.
flutter run -d chrome --web-port 8722 --dart-define-from-file=config/production.local.json
Email confirmation accepts links and six- through ten-digit codes. A successful confirmation may open Access denied until a trusted operator assigns a role; this is the expected behavior for a new, unassigned account.
Roles
| Role | Read | Create/update | Delete |
|---|---|---|---|
| Unassigned | No | No | No |
| Viewer | Yes | No | No |
| Editor | Yes | Yes | No |
| Admin | Yes | Yes | Yes |
Roles come from kite_user_roles. Clients can read only their own role and cannot grant access. RLS checks current database state, so revocation takes effect on the next request even with an older JWT. UI guards improve UX; they do not replace server authorization.
The included policies cover one shared workspace. Add tenant membership and row ownership policies for multiple organizations.
Session lifecycle
The SDK verifies credentials, persists sessions and refreshes tokens. Resource adapters read the latest token on each request. Startup validates restored identity and reloads roles. Native session tokens and PKCE verifiers use OS secure storage; web sessions use SDK browser storage. Display preferences are stored separately.
Registration, confirmation codes and recovery use actual Supabase endpoints. Recovery uses PKCE and preserves its intent across cold starts. The unconfigured demo sends no email and displays its sample code explicitly. Do not combine demo auto-sign-in with production Auth.
Platform setup and verification
Android, iOS and macOS register the template callback kite://login/auth/callback. Customize it before distribution and configure the allowed redirect in Supabase. Windows needs a protocol association in the installer. Test real email delivery and signed app callbacks in staging.
For the full configuration, initial role assignment SQL, platform details, storage tradeoffs and verification commands, read docs/AUTHENTICATION.md in the repository.