Authentication methods
How sessions work
When a user signs in, Knowledge Stack issues a session token as anhttpOnly cookie called ks_uat. This cookie is automatically sent with every subsequent API request — no need to manage tokens manually.
- The session cookie is secure and not accessible to client-side JavaScript.
- Sessions are scoped to a specific tenant. To switch tenants, refresh the token via the
/auth/uatendpoint.
Email/password authentication
Sign-up flow
- Verify email — Call
POST /auth/pw/email_verificationwith the user’s email. They’ll receive a verification token. - Create account — Call
POST /auth/pw/userwith the verification token and their chosen password.
Sign-in
ks_uat session cookie. Include this cookie in all subsequent requests.
Password reset
Two flows are available:- Authenticated reset — A signed-in user calls
POST /auth/pw/resetwith their current and new password. - Forgot password — Call
POST /auth/pw/send_reset_email, thenPOST /auth/pw/reset_with_tokenwith the emailed token.
SSO (Google and Tenant providers)
Knowledge Stack implements the Authorization Code with PKCE flow for SSO.SSO flow
- Initiate — Call
POST /auth/sso/initiatewith the provider type. The response includes an authorization URL. - Redirect — Redirect the user to the authorization URL. They authenticate with their identity provider.
- Callback — The provider redirects back to your application. The callback endpoint (
GET /auth/sso/oauth2/callback) exchanges the authorization code for a session and sets theks_uatcookie.
