OAuth — user login
Purpose
Employees of a company sign in with their integeri account.
The other application does not store a separate password. It receives a short-lived token
with the profile.read scope.
The rest of the HTTP API (locations, teams, users, courses) stays on client credentials. That is described in the API documentation.
Two client kinds
-
Machine client: grant
client_credentials, scope*, access token 30 days. The token acts as the company's service user. -
User client: grants
authorization_codeandrefresh_token, scopeprofile.readonly. Access token 60 minutes, refresh token 14 days. No service user.client_credentialsis not allowed for this client.
Each company has one user client. The redirect URI is exactly
https://<their-domain>/auth/callback (several URIs are allowed; each must match in full).
Flow
- The other application creates a
code_verifierand a SHA-256code_challenge(S256). - The browser opens
GET https://next.integeri.com/oauth/authorize. - Without a session the
/loginpage is used, including two-factor. There is no extra consent screen. - integeri checks: active user, same company as the client, scope exactly
profile.read, PKCE method S256. - The browser returns to the redirect URI with
codeand the suppliedstate. - The other application's server exchanges the code at
POST https://next.integeri.com/oauth/token.
Token exchange
POST https://next.integeri.com/oauth/token
Content-Type: application/x-www-form-urlencoded
grant_type=authorization_code
&client_id=<UUID>
&client_secret=<secret>
&redirect_uri=https://<their-domain>/auth/callback
&code=<code>
&code_verifier=<verifier>
The response contains access_token, refresh_token, token_type (Bearer),
and expires_in (about 3600). The code is single-use and short-lived.
The password grant and the implicit grant are not enabled.
A machine client cannot use this grant, and a user client cannot use client_credentials.
Refresh
POST https://next.integeri.com/oauth/token
Content-Type: application/x-www-form-urlencoded
grant_type=refresh_token
&refresh_token=<refresh token>
&client_id=<UUID>
&client_secret=<secret>
The previous refresh token is revoked when it is used. The response contains a new pair.
Access tokens issued this way last 60 minutes again, and the scope stays profile.read.
Profile and logout
GET https://next.integeri.com/api/v1/auth/me
Authorization: Bearer <access_token>
The response is the signed-in employee, not the service user:
id,email,state,company_idroles— role namesteam_ids— the user's teams
POST https://next.integeri.com/api/v1/auth/logout
Authorization: Bearer <access_token>
Logout revokes the access token and the refresh token that belongs to it.
Limits
- User tokens may call only
GET /api/v1/auth/meandPOST /api/v1/auth/logout. Every other route returns 403. - The user must be active and belong to the client's company.
- The redirect URI must be one of the registered URIs.
- PKCE with S256 is required for this confidential client as well.