3-Mode Authentication (Shared Habify SSO · BYO JWKS · Project Local Auth)
Choose from three authentication modes per project: Mode A Shared Habify SSO (OIDC + PKCE), Mode B BYO Auth (JWKS), or Mode C Isolated Local Auth (Email/Password + BYO Phone/Email OTP inside habify_sys).
Last updated: 2026-11-25
Mode A: Shared Habify Account (OIDC + PKCE S256)
Provision an OIDC application automatically through auth-service. End-users sign in with one click via Habify Account (auth.habifyhub.com) using standard OIDC + PKCE S256 with built-in passkeys, social OAuth, and 2FA.
GET https://auth.habifyhub.com/oauth/authorize
?response_type=code
&client_id=YOUR_PROJECT_OIDC_CLIENT_ID
&redirect_uri=https://yourapp.vn/api/auth/habify/callback
&scope=openid+profile+email
&code_challenge=S256_CHALLENGE
&code_challenge_method=S256Mode B: BYO Auth (Firebase, Auth0, Clerk, Supabase, NextAuth)
Already have user auth? Configure your existing jwks_url (SSRF-guarded, cached 10 minutes), issuer, audience, and sub/role claim mapping. Supports RS256, ES256, and Vault-backed HS256; alg=none is strictly rejected.
Mode C: Project Local Auth (Email/Password & BYO Phone/Email OTP)
Built for white-label B2C storefronts, clinics, job portals, and customer apps using Email/Password or Phone/Email OTP. User records, Argon2id hashes, and refresh-token families live strictly inside your project's isolated habify_sys schema (masked on Clone-to-Sandbox). OTPs dispatch strictly over your BYO SMS, Zalo ZBS, or Email accounts, protected by Cloudflare Turnstile, country allowlists, cooldowns, daily caps, ES256 Vault keypairs, and refresh-token reuse detection.
// @habifybase/sdk (trình duyệt hoặc mobile)
await habify.auth.sendOtp({ phone: '0912345678', purpose: 'login', turnstile_token });
const session = await habify.auth.verifyOtp({ phone: '0912345678', code: '123456' });
// Token tự động gắn cho client.db (RLS), client.chat, client.notification & billingHow MAU (Monthly Active Users) Is Measured
MAU equals the count of distinct verified JWT sub identifiers calling Data API or Unified Gateway within a UTC calendar month at the Workspace level. Anonymous hb_pk_* requests execute as role 'anon' and do not count toward MAU.