Skip to main content
DualMind has one identity provider, Supabase Auth, and one role store, the role column of public.users. The API trusts the Supabase access token for who you are and the database for what you may do.

Sign-in

Clients send the session’s access token on every API call:
supabase-js refreshes the access token before it expires; the API never sees refresh tokens (except the Telegram bot, which refreshes its own stored sessions).

Token validation

Configured in Program.cs with AddJwtBearer:
JWT_SECRET is required in every environment. If the Supabase project moves to asymmetric JWT signing keys, update the API to validate against the project’s JWKS before switching, or every token will be rejected.

Roles

  • Allowed roles are admin and user (AdminFieldRules.AllowedRoles).
  • New users are created with user by UserSyncService the first time they create a thread, run a battle or chat. An existing role is never overwritten by that sync.
  • The AdminOnly policy is RequireRole("admin"). All nine admin controllers use it.
  • Because the role is read on each request, promoting or demoting someone takes effect on their next call; no new token is needed.

Endpoint access

The admin gate

The admin panel doesn’t decide who is an admin; the API does.
1

Sign in

Email and password against Supabase Auth.
2

Ask the API

GET /api/admin/dashboard/health with the new token.
3

Act on the status

200: show the panel. 403: “this account doesn’t have the admin role”. 401: the API rejected the token. A 401 during use signs the panel out.
To grant access, set role = 'admin' on the user’s public.users row (see FAQ).
Last modified on October 18, 2026