SAML SSO (dashboard users)

Per-org SAML SSO for dashboard login. Password auth stays available for users outside configured SSO domains. Signers and API keys are unchanged.

Environment variables

VariableRequiredDescription
SSO_ENABLEDProductionSet to true to expose SSO login APIs and callback provisioning.
NEXT_PUBLIC_SSO_ENABLEDProductionClient mirror of SSO_ENABLED for the login page SSO button.
SSO_PROVISIONING_ENABLEDProduction IdP syncSet to true when Supabase Auth SAML admin API is available (Supabase Pro/Enterprise or self-hosted SAML). Registers IdP metadata on save.
NEXT_PUBLIC_SUPABASE_URLYesSupabase project URL (SP metadata: {url}/sso/saml/metadata).
SUPABASE_SERVICE_ROLE_KEYYesUsed for IdP registration and server-side SSO initiation.
NEXT_PUBLIC_BASE_URLRecommendedCanonical app URL for SAML redirect (e.g. https://atlaswork.ai). Falls back to request origin.

Admin setup

  1. Team → Settings → SAML single sign-on
  2. Paste IdP metadata URL (HTTPS)
  3. Add email domain(s)
  4. Choose JIT (auto member) or invite-only
  5. Configure your IdP with Atlas SP metadata from Supabase

Data model

organizations.sso_config JSONB:

  • enabled, metadata_url, entity_id, supabase_provider_id
  • domains[] (exclusive with domain auto-join for those domains)
  • jit_enabled (default true)

Routes

  • GET/PATCH /api/org/sso — admin settings
  • GET /api/auth/sso/lookup?email= — login domain routing
  • POST /api/auth/sso — start SAML redirect
  • POST /api/auth/sso/complete — post-callback org membership
  • /auth/callback — client session handoff

OAuth MCP routes under /api/oauth/* are untouched.