Skip to main content
In 5 minutes you’ll have a Sign in with Cativa button working in your app. This flow is ideal when you want the end user to authenticate with their community account, without creating a new password in your product. If you only need server-to-server access (jobs, syncs, no user in the loop), use First API call, which is simpler.

What OAuth 2.0 with PKCE is

OAuth 2.0 is the standard protocol for an app to request access on behalf of a user without ever seeing their password. The user logs into Cativa, Cativa hands your app a temporary code, and your app exchanges that code for an access_token. PKCE (Proof Key for Code Exchange) is a security layer on top of OAuth. Before sending the user to log in, you generate a random secret (the code_verifier) and send only its hash (the code_challenge). When you exchange the code for a token, you reveal the original code_verifier. Cativa recomputes the hash and checks it. This stops anyone who intercepts the code from using it, because they don’t have the code_verifier.
Cativa SSO endpoints follow the OIDC standard and are organized by tenant slug ({customerName}). That slug is the community’s public subdomain. Confirm with the tenant admin which value to use. The endpoint base is https://apis.cativalab.digital/tenant/api/v2/sso/{customerName}.

The flow at a glance

1

Create an OAuth App in the Console

Go to app.cativa.digital/admin/developers, OAuth Apps tab, click Create app.Save the returned client_id and client_secret. The secret is shown only once, store it carefully in a credentials vault.
2

Configure the redirect URI

In the same modal, add your redirect URI (e.g. https://myapp.com/callback, or http://localhost:3000/callback for development). The redirect_uri you send later must match exactly one of the ones registered here.
3

Redirect the user to /authorize

On the frontend, generate a code_verifier and code_challenge (PKCE), store the verifier in the session, and redirect to the tenant’s /authorize endpoint:
Store the state in the session too and check it in the callback. It protects against CSRF: if the state that comes back isn’t the one you sent, drop the request.
4

Exchange the code for an access_token in the callback

After the user consents, Cativa redirects to your URL with ?code=...&state=.... On the backend, POST to the same tenant’s /token endpoint with the body in application/x-www-form-urlencoded:
The response follows the OIDC standard:
The code is single-use and expires within a few minutes. Do the exchange immediately in the callback. If you get invalid_grant, the code likely expired or was already used (for example, the user reloaded the callback page).
5

Fetch the user's info

Use the access_token against the userinfo endpoint:
Response:
The sub is the user’s stable ID in Cativa. Use it as the key to tie the user to your app’s session.
The tenant’s OIDC discovery document lives at https://apis.cativalab.digital/tenant/api/v2/sso/{customerName}/.well-known/openid-configuration and lists every endpoint (authorize, token, userinfo, jwks) plus the supported algorithms (S256 for PKCE, ES256 for id_token signing). The public JWKS is served at https://apis.cativalab.digital/tenant/api/v2/sso/{customerName}/jwks. Libraries like jose (Node) or PyJWT (Python) read the discovery doc and validate the id_token automatically.
This quickstart shows the happy path. Before you ship to production, validate the id_token signature via JWKS and handle OAuth errors (invalid_grant, invalid_client, PKCE failure). The full walkthrough, covering SPA, backend, and mobile, is in the Implement Sign in with Cativa guide.

Next steps

Full SSO guide

SPA, backend, and mobile, id_token validation via JWKS, token refresh, and common errors.

Tenants and Customers

Understand the customerName concept in the OIDC flow and when tenant matters in integrations.

First API call

For server-to-server integrations, use an API Key directly instead of OAuth.

Badges as Permissions

How the user’s sub connects to what they can access in the community.