Adding Captivo ID Sign-In to Your Application: OpenID Connect and PKCE
ON THIS PAGE
When every internal application has its own user table and password, two problems follow: you have to set up two-step verification in each one, and someone who leaves stays in some application. If the application hands sign-in to Captivo ID, you manage people and rules in one place.
Connecting in five steps
- Register the application. On the organisation page, Applications → New application. Enter the name and redirect addresses; you get a client id and a client secret that is shown once. Keep the secret only on your application's server side.
- Give your library the discovery address. https://id.captivo.io/.well-known/openid-configuration. The library finds the authorization, token, userinfo, jwks and end_session endpoints from it.
- Send the user to the authorization endpoint. response_type=code, scope=openid email profile org, state, nonce and PKCE (code_challenge_method=S256).
- Exchange the code on your server. Send code, code_verifier and your client credentials (HTTP Basic) to the token endpoint; you get an ID token and an access token.
- Verify the ID token and open the session. Check the signature with the JWKS, and iss, aud (the client id), nonce and exp.
What you get back
- sub: the person's permanent identity; it stays the same even if the e-mail changes. Key your user table on it, not on the e-mail.
- email, email_verified: the verified address; email_verified is always true, because an unverified address cannot sign in.
- name (when present), org, org_name and role (OWNER, ADMIN, MEMBER; null if not a member).
- amr: how the sign-in was verified (pwd, otp, passkey, mfa, fed, trusted). amr is only in the ID token, and whether a second step was taken is decided by checking for otp or mfa.
Who can sign in
An application is registered by default with "members only" on: only the accepted members of your organisation get a token, and anyone else is refused even if their identity is verified. If you turn it off, anyone with a Captivo account can sign in, and role is null for non-members. If you choose groups for the application, only members of those groups get in, and that rule requires membership as well.
Sign-out and other routes
- To sign out, send the user to the end_session endpoint with id_token_hint and a registered post_logout_redirect_uri.
- For applications that do not speak OpenID Connect (Jira, Salesforce, AWS), Captivo ID is a SAML 2.0 identity provider. There is no SAML single logout, encrypted assertion or IdP-initiated sign-in.
- There are ready-made templates for Slack, GitHub Enterprise Cloud, Zoom, Zendesk, Google Workspace and Cloudflare Zero Trust; you type only the subdomain.
With Captivo ID
All the endpoints, example requests and the Admin API are in the Captivo ID developer documentation. For sign-in methods, read passwordless sign-in with passkeys; for members opening and closing automatically, read enterprise sign-in and SCIM.