Flow
- Authorize. Send the user to
PKCE with
S256is required for every app. The user signs in, picks one organization they own or administer and approves the scopes. - Receive the code at your
redirect_urias?code=...&state=...(or?error=access_denied). Codes work once, for 10 minutes. - Exchange it.
POST /api/oauth/token, form-encoded, withgrant_type=authorization_code,code,redirect_uri,code_verifierand your client credentials (HTTP Basic, orclient_idandclient_secretin the body; public apps send onlyclient_id). You get{ access_token, refresh_token, expires_in: 3600, scope, organization_id }. - Call the API with
Authorization: Bearer <access_token>. It sees only that organization and only the granted scopes. - Refresh with
grant_type=refresh_token. Refresh tokens last 30 days and rotate: each use returns a new pair and retires the old one. Presenting a retired token again revokes the whole authorization. A refresh may narrowscopebut never widen it. - Revoke with
POST /api/oauth/revokeandtoken=...(RFC 7009).
/.well-known/oauth-authorization-server. The token and revocation endpoints answer CORS (*) because they use no cookies.