Login Flow
How your app signs users in with KPass: send them to KPass, receive a code, exchange it for their identity. Start here.
This is how your app lets KPass handle login for its users. Three steps: send the user to KPass, KPass sends them back with a one-time code, you exchange that code for who they are. Your app never sees or stores a password.
This is the one flow every integration needs — start here before anything else in this doc.
Step 1: Send the user to KPass to log in
Redirect the user's browser to KPass's login page. If they already have an active KPass session, they're sent straight back to you with a code — no form shown.
GET /auth/login
| Parameter | Required | Description |
|---|---|---|
client_id | Yes | Your API client's id (see API Clients) |
response_type | Yes | Always code |
redirect_uri | Yes | Must exactly match one of the client's configured Redirect URLs |
state | No | Round-tripped back to you unchanged — use a random value to protect against CSRF |
scope | No | Accepted but not currently used |
https://kpass.one/auth/login ?client_id=YOUR_CLIENT_ID &response_type=code &redirect_uri=https%3A%2F%2Fyourapp.example.com%2Fcallback &state=a-random-csrf-string
If your client has any Client URLs configured, the browser's Referer header on this request must match one of them. Most browsers send it by default, but strict privacy settings or referrer-stripping proxies can break this silently — if users get an unexpected error here, check that first.
KPass shows its login form, handles the user's credentials, and — depending on the app's settings — checks the password against your LDAP directory or sends the user to Okta or Microsoft, then asks for a second step (authenticator app, passkey, emailed code or a recovery code). Your app is never involved in any of that.
Step 2: KPass redirects back to your app
Once the user is authenticated, KPass redirects their browser to your redirect_uri:
https://yourapp.example.com/callback?code=AUTHORIZATION_CODE&state=a-random-csrf-string
Check that state matches what you sent in Step 1, then move straight to Step 3 — the code is short-lived and single-use.
Step 3: Exchange the code for the user's identity
From your backend (never the browser), call:
GET /api/v1/authorise
Unlike every other api/v1 endpoint (see API Overview), this one takes client_id and api_secret as query parameters, not X-Client-Id/X-Api-Secret headers. This is the one exception, kept for compatibility with how this endpoint has always worked.
| Parameter | Required | Description |
|---|---|---|
code | Yes | The code from Step 2 |
client_id | Yes | Same client id used in Step 1 |
api_secret | Yes | Your API client's secret |
curl "https://kpass.one/api/v1/authorise?code=AUTHORIZATION_CODE&client_id=YOUR_CLIENT_ID&api_secret=YOUR_API_SECRET"
Response:
{
"userId": "your-own-reference-id-for-this-user",
"userType": "customer",
"userName": "jane.doe",
"userRole": "support-agent",
"orgId": "..."
}
userId here is the user's Reference Id — your own id for them (see Users) — never KPass's internal id. Missing or wrong api_secret returns 401; an unknown or already-used code returns 400.
That's it — create your own session/cookie/JWT for this user in your app using the identity KPass just gave you. If you also need to check what they're allowed to do once they're in, that's a separate concern — see Permissions.