Aller au contenu principal

OAuth 2.0 and OpenID Connect

Use authorization code with S256 PKCE for interactive login. Start with the OAuth integration guide. Tokens from this protocol are separate from the application tokens returned by /login/. Examples show possible response shapes; available identity fields depend on the grant and requested scopes.

Interactive flow: prepare PKCE, authorize, complete any requested consent, exchange the callback code for tokens, then call userinfo. Server-side PKCE initialization is optional; client credentials and refresh requests use their own token grant without repeating browser consent.

API conventions · All endpoints · Schemas

/e/v1/auth/jwt-to-session/​

Create a browser authentication session from an application JWT.

POST​

Required JSON token (valid application JWT). Preserve the returned Set-Cookie for subsequent hosted OAuth requests.

Request fields (combine with the requirements and schema above):

LocationFieldFallback when absent
bodytokennot supplied

Example request body:


{
"token": "APPLICATION_JWT"
}

Success and error response examples

Illustrative values; conditional branches are alternatives. Fields vary with the operation and account configuration.

200 — json


{
"message": "Session created successfully",
"user_id": "EXAMPLE_USER_ID",
"session_key": "EXAMPLE_SESSION_KEY",
"session_expiry": "EXAMPLE_SESSION_EXPIRY",
"debug_info": {
"session_cookie_name": "EXAMPLE_SESSION_COOKIE_NAME",
"session_cookie_domain": "EXAMPLE_SESSION_COOKIE_DOMAIN",
"session_cookie_secure": "EXAMPLE_SESSION_COOKIE_SECURE",
"session_cookie_samesite": "EXAMPLE_SESSION_COOKIE_SAMESITE",
"current_cookies": "EXAMPLE_CURRENT_COOKIES"
}
}

400 — json


{
"error": "JWT token is required"
}

400 — json


{
"error": "Invalid token payload"
}

400 — json


{
"error": "User not found"
}

401 — json


{
"error": "Token expired"
}

401 — json


{
"error": "Invalid token"
}

500 — json


{
"error": "Internal server error: EXAMPLE"
}

/e/v1/oauth/pkce/init/​

Create an optional server-side PKCE session.

For the recommended integration, let your OAuth/OIDC library generate and retain the verifier: see the complete application starter. This endpoint is an alternative. It returns session_id, code_challenge, and code_challenge_method; it never returns the verifier. Pass session_id as pkce_session_id during authorization and code exchange for the same client. Sessions expire after 10 minutes and can be consumed once.

OPTIONS​

Browser CORS preflight only; this does not create a PKCE session. No JSON body or developer session is required. A registered application origin or configured allowed origin is required for browser access. In Postman, use the Headers tab: Origin: https://your-app.example, Access-Control-Request-Method: POST, Access-Control-Request-Headers: content-type. Browsers send this automatically.

Request fields (combine with the requirements and schema above):

LocationFieldFallback when absent
headerOriginnot supplied
Success and error response examples

Illustrative values; conditional branches are alternatives. Fields vary with the operation and account configuration.

200 — json

JSON response varies with the request. See the operation requirements and linked schema; validation errors may be keyed by field name.

POST​

No developer token, client secret or signed-in developer session is required. Required JSON client_id (the active public protocol identifier, not the resource UUID), in an active workspace.

{ "client_id": "YOUR_CLIENT_ID" }

A successful 200 returns the session and S256 challenge. For browser calls, register the website origin in the application's allowed web origins or callback URLs. Unknown clients return 400, unregistered browser origins return 403, and excessive initialization attempts return 429. A 401 from an older deployment means this public route is still blocked; use client-generated PKCE or contact support.

Request fields (combine with the requirements and schema above):

LocationFieldFallback when absent
bodyclient_idnot supplied
headerOriginnot supplied

Example request body:


{
"client_id": "PUBLIC_CLIENT_ID"
}

Success and error response examples

Illustrative values; conditional branches are alternatives. Fields vary with the operation and account configuration.

200 — json


{
"session_id": "PKCE_SESSION_ID",
"code_challenge": "BASE64URL_SHA256",
"code_challenge_method": "S256"
}

200 — json

JSON response varies with the request. See the operation requirements and linked schema; validation errors may be keyed by field name.

400 — json


{
"error": "Expected a JSON object"
}

400 — json


{
"error": "client_id is required"
}

400 — json


{
"error": "Invalid client_id"
}

403 — json


{
"error": "Origin is not registered for this application"
}

/e/v1/oauth/authorize/​

Start authorization or submit the hosted consent decision.

Browser application-user session; unauthenticated browsers are redirected to hosted login. Retain cookies and state through the redirect chain.

GET​

Required query strings: client_id, redirect_uri, response_type (use code). Optional scope (space-delimited), state, nonce. Public clients require PKCE: code_challenge plus code_challenge_method=S256, or a valid initialized pkce_session_id. Use an exact registered redirect URI. Supported response branches also include token/id_token combinations in the implementation; authorization code with PKCE is the documented first integration.

For each login attempt, your application generates independent random state and nonce, saves them with its PKCE verifier, and validates them on return. The code_challenge is Base64URL(SHA-256(verifier)) without padding; never send the verifier in the authorization URL. Follow the working generator and validation steps, or use the complete application starter.

Choose one PKCE approach: generate and retain the verifier in your application (recommended), or initialize a server-side PKCE session and pass its returned session_id as pkce_session_id. The session belongs to that client and expires after 10 minutes. Neither state nor nonce is obtained from the dashboard.

Request fields (combine with the requirements and schema above):

LocationFieldFallback when absent
querytemp_authnot supplied
queryclient_idnot supplied
queryredirect_urinot supplied
queryresponse_typenot supplied
querystatenot supplied
querypkce_session_idnot supplied
queryscope''
querycode_challengenot supplied
querycode_challenge_methodnot supplied
querynoncenot supplied
Success and error response examples

Illustrative values; conditional branches are alternatives. Fields vary with the operation and account configuration.

302 — redirect

Redirect: inspect Location and preserve cookies.

500 — json


{
"error": "server_error",
"error_description": "An unexpected error occurred: EXAMPLE"
}

POST​

Form body: required consent_token; approved=true grants consent (literal form string). Requires matching consent session/cache state. This is distinct from JSON /oauth/consent/approve/.

Request fields (combine with the requirements and schema above):

LocationFieldFallback when absent
formconsent_tokennot supplied
formapprovednot supplied
Success and error response examples

Illustrative values; conditional branches are alternatives. Fields vary with the operation and account configuration.

302 — redirect

Redirect: inspect Location and preserve cookies.

400 — json


{
"error": "invalid_request",
"error_description": "Missing consent token"
}

400 — json


{
"error": "invalid_request",
"error_description": "Invalid or expired consent token"
}

400 — json


{
"error": "invalid_request",
"error_description": "Consent session expired"
}

500 — json


{
"error": "server_error",
"error_description": "An unexpected error occurred: EXAMPLE"
}

Approve or deny consent through the frontend JSON API.

Start with authorization to establish the consent state. Call this endpoint only when that flow requires a consent decision, using its consent_token and the same browser session.

POST​

Required JSON consent_token; approved must be boolean true to approve. Requires live consent state in the matching session/cache. Returns redirect_url and status rather than issuing a redirect response.

Request fields (combine with the requirements and schema above):

LocationFieldFallback when absent
bodyconsent_tokennot supplied
bodyapprovednot supplied

Example request body:


{
"consent_token": "CONSENT_TOKEN",
"approved": true
}

Success and error response examples

Illustrative values; conditional branches are alternatives. Fields vary with the operation and account configuration.

200 — json


{
"redirect_url": "EXAMPLE_REDIRECT_URL",
"status": "denied"
}

200 — json


{
"redirect_url": "EXAMPLE_REDIRECT_URL",
"status": "approved"
}

400 — json


{
"error": "invalid_request",
"error_description": "Missing consent token"
}

400 — json


{
"error": "invalid_request",
"error_description": "Invalid or expired consent token"
}

400 — json


{
"error": "invalid_request",
"error_description": "Consent session expired"
}

500 — json


{
"error": "unexpected_response",
"error_description": "Authorization handler returned an unexpected response type"
}

500 — json


{
"error": "server_error",
"error_description": "An unexpected error occurred: EXAMPLE"
}

500 — json


{
"error": "server_error",
"error_description": "User not found"
}

/e/v1/oauth/token/​

Exchange a code, refresh an OAuth token, or issue a client-credentials token.

Confidential clients: HTTP Basic client_id:client_secret or body credentials. Public clients: body client_id with PKCE, no secret. Client ID refers to the public identifier.

POST​

Accepts JSON or form data. Required grant_type: authorization_code, refresh_token, or client_credentials. Code grant: required code, redirect_uri, plus code_verifier or valid server-side pkce_session_id when PKCE was used. Refresh grant: required refresh_token. Client credentials: optional space-delimited scope, restricted to configured grants/scopes. The handler does not implement grant_type=password.

For authorization_code, first complete authorization and any required consent, then use the code returned to your registered callback. Keep the same redirect URI and original PKCE verifier/session. For refresh_token, use an OAuth refresh token from this endpoint, not the separate application-login refresh token. For client_credentials, use a confidential client configured for that grant; no browser consent step is involved.

Example request body:


{
"grant_type": "authorization_code",
"client_id": "PUBLIC_CLIENT_ID",
"code": "AUTHORIZATION_CODE",
"redirect_uri": "http://127.0.0.1:8080/callback",
"code_verifier": "ORIGINAL_PKCE_VERIFIER"
}

Success and error response examples

Illustrative values; conditional branches are alternatives. Fields vary with the operation and account configuration.

200 — json


{
"access_token": "OAUTH_ACCESS_TOKEN",
"token_type": "Bearer",
"expires_in": 3600,
"refresh_token": "OAUTH_REFRESH_TOKEN",
"scope": "openid profile email",
"id_token": "OIDC_ID_TOKEN_WHEN_OPENID_REQUESTED"
}

200 — json

JSON response varies with the request. See the operation requirements and linked schema; validation errors may be keyed by field name.

500 — json


{
"error": "server_error",
"error_description": "An internal server error occurred"
}

OPTIONS​

No additional JSON payload is read by this operation.

Success and error response examples

Illustrative values; conditional branches are alternatives. Fields vary with the operation and account configuration.

200 — text/XML

HTML or text/XML response; do not parse as JSON.

/e/v1/oauth/revoke/​

Revoke an OAuth token.

Client authentication uses Basic or body client credentials, following the token endpoint rules.

POST​

JSON or form: required token, plus client identity; optional token_type_hint. Success is 200 with {} even when the supplied token is not found, after client validation.

Example request body:


{
"client_id": "PUBLIC_CLIENT_ID",
"token": "OAUTH_ACCESS_TOKEN",
"token_type_hint": "access_token"
}

Success and error response examples

Illustrative values; conditional branches are alternatives. Fields vary with the operation and account configuration.

200 — json


{}

500 — json


{
"error": "server_error",
"error_description": "An unexpected error occurred"
}

/e/v1/oauth/userinfo/​

Return OIDC user claims permitted by the access token.

Required Authorization: Bearer OAUTH_ACCESS_TOKEN.

GET​

No body; claim availability follows scopes.

Success and error response examples

Illustrative values; conditional branches are alternatives. Fields vary with the operation and account configuration.

200 — json


{
"sub": "11111111-1111-4111-8111-111111111111",
"email": "[email protected]",
"email_verified": true,
"given_name": "Alex",
"family_name": "Developer"
}

200 — json

JSON response varies with the request. See the operation requirements and linked schema; validation errors may be keyed by field name.

401 — json


{
"error": "invalid_token",
"error_description": "Invalid or missing access token"
}

500 — json


{
"error": "server_error",
"error_description": "An unexpected error occurred"
}

POST​

Same as GET; the access token is read from Authorization, not the JSON body.

Success and error response examples

Illustrative values; conditional branches are alternatives. Fields vary with the operation and account configuration.

200 — json


{
"sub": "11111111-1111-4111-8111-111111111111",
"email": "[email protected]",
"email_verified": true,
"given_name": "Alex",
"family_name": "Developer"
}

200 — json

JSON response varies with the request. See the operation requirements and linked schema; validation errors may be keyed by field name.

401 — json


{
"error": "invalid_token",
"error_description": "Invalid or missing access token"
}

500 — json


{
"error": "server_error",
"error_description": "An unexpected error occurred"
}

/e/v1/.well-known/jwks.json​

Publish the configured OIDC public signing key.

GET​

Public; no input. Needs a valid configured PEM public key. Use its kid to select the verifier key.

Success and error response examples

Illustrative values; conditional branches are alternatives. Fields vary with the operation and account configuration.

200 — json


{
"keys": [
{
"kty": "RSA",
"use": "sig",
"kid": "1",
"alg": "RS256",
"n": "RSA_MODULUS_BASE64URL",
"e": "AQAB"
}
]
}

200 — json


{
"keys": [
{
"kty": "RSA",
"use": "sig",
"alg": "EXAMPLE_ALG",
"kid": "EXAMPLE_KID",
"n": "EXAMPLE_N",
"e": "EXAMPLE_E"
}
]
}

500 — json


{
"error": "configuration_error",
"error_description": "Public key not configured"
}

500 — json


{
"error": "configuration_error",
"error_description": "Invalid public key format"
}

500 — json


{
"error": "server_error",
"error_description": "An error occurred while generating JWKS"
}

/e/v1/.well-known/openid-configuration​

Publish OIDC discovery metadata.

GET​

Public; no input. The issuer and endpoints derive from OIDC configuration. Verify local issuer values before integrating.

Success and error response examples

Illustrative values; conditional branches are alternatives. Fields vary with the operation and account configuration.

200 — json


{
"issuer": "http://127.0.0.1:8002/e/v1",
"authorization_endpoint": "http://127.0.0.1:8002/e/v1/oauth/authorize/",
"token_endpoint": "http://127.0.0.1:8002/e/v1/oauth/token/",
"userinfo_endpoint": "http://127.0.0.1:8002/e/v1/oauth/userinfo/",
"jwks_uri": "http://127.0.0.1:8002/e/v1/.well-known/jwks.json"
}

200 — json

JSON response varies with the request. See the operation requirements and linked schema; validation errors may be keyed by field name.

500 — json


{
"error": "server_error",
"error_description": "An error occurred while generating discovery document"
}

/e/v1/oauth/clients/{client_id}/branding/​

Read public hosted-login branding.

GET​

No authentication; path value is the public client_id. Returns branding or null. Invalid client returns 404.

Path parameters: client_id (str, required).

Related schemas: OAuthClientBranding.

Success and error response examples

Illustrative values; conditional branches are alternatives. Fields vary with the operation and account configuration.

200 — json


{
"id": "11111111-1111-4111-8111-111111111111",
"oauth_client": "11111111-1111-4111-8111-111111111111",
"logo_url": "EXAMPLE_LOGO_URL",
"company_name": "EXAMPLE_COMPANY_NAME",
"primary_color": "EXAMPLE_PRIMARY_COLOR",
"secondary_color": "EXAMPLE_SECONDARY_COLOR",
"background_color": "EXAMPLE_BACKGROUND_COLOR",
"theme": "light",
"custom_css": "EXAMPLE_CUSTOM_CSS",
"show_social_logins": true,
"terms_url": "https://app.example.test/callback",
"privacy_url": "https://app.example.test/callback",
"created_at": "2026-10-26T12:00:00Z",
"updated_at": "2026-10-26T12:00:00Z"
}

200 — json

JSON response varies with the request. See the operation requirements and linked schema; validation errors may be keyed by field name.

404 — json


{
"error": "OAuth client not found"
}

500 — json


{
"error": "Failed to fetch branding"
}