Sumsub ID — OIDC
Set up an OpenID Connect integration with Sumsub ID.
Verify with Sumsub ID lets your service integrate with a user's Sumsub ID account using OpenID Connect (OIDC). Depending on the scopes requested, your service can request supported identity claims or permission to generate Sumsub ID share tokens.
Reusable KYC Gateway uses Verify with Sumsub ID as part of its integration. For the Gateway-specific flow, see this article.
Implementation details
The OIDC discovery document is a JSON file that lists the URLs and settings needed for your integration. For example, its authorization_endpoint field gives the URL where you send users to start authorization. Use the document for your environment:
- Production:
https://id.sumsub.com/.well-known/openid-configuration - Sandbox:
https://id-sbx.sumsub.com/.well-known/openid-configuration
The configuration includes the authorization, token, and user info endpoints, supported grant and response types, and the public keys for ID token validation. Use the discovery metadata for the environment you are integrating with.
Supported scopes
| Scope | Description |
|---|---|
openid | Required by OpenID Connect. Requests an ID token. |
email | Grants access to the user's email address. |
name | Grants access to the user's name information. |
share | Grants permission to generate a Sumsub ID share token. |
offline_access | Grants permission to obtain a refresh token. |
Select scopes for your use case. For Gateway, openid, share and offline_access are enabled by default. Additional scopes are available on request. Include offline_access in the authorization request when you need a refresh token.
The user can revoke authorization from their Sumsub ID account.
Enable OIDC integration
To configure your integration:
- In the Dashboard, go to Configurations → Developers → OIDC Settings.
- Generate a client secret and register the return URL. Configure Sandbox and Production separately.
- Save your changes.
Your integration can now start an authorization code flow. Keep the client secret on your backend.
Start authorization code flow
Use the standard OAuth 2.0 authorization code flow with PKCE. You can initiate it from your own button or link. No Sumsub JavaScript library or prebuilt button is required.
- Generate a unique unpredictable
stateand PKCE code verifier for the request. Derivecode_challengeas the base64url-encoded SHA-256 hash of the verifier, without padding. Usecode_challenge_method=S256. Store the verifier and state securely for the transaction. - Build the authorization URL using
https://id.sumsub.com/api/snsId/oauth/authorizefor Production orhttps://id-sbx.sumsub.com/api/snsId/oauth/authorizefor Sandbox. These are also listed asauthorization_endpointin the discovery documents.
Includeresponse_type=code, yourclient_id, the registeredredirect_uri, the requested space-separatedscope,state,code_challenge, andcode_challenge_method=S256. Use the exact registered redirect URI. If you use an ID token, send a uniquenonceand validate it on return. - Open the URL in a desktop popup with
response_mode=web_message, or in the current tab withresponse_mode=query. Use the current tab on mobile and when a popup is blocked. - Validate the response and the returned
state.- If authorization fails, handle the error and start a new flow when appropriate.
- If it succeeds, exchange the short-lived code at the discovered token endpoint from your backend, using
grant_type=authorization_code, the sameredirect_uri, the originalcode_verifier, and the configured client authentication.
- Validate the ID token's signature, issuer, audience, expiry and nonce where used. Use the access token with the discovered userinfo endpoint for claims allowed by the granted scopes. Store tokens securely.
Request example:
https://id.sumsub.com/api/snsId/oauth/authorize?response_type=code&client_id=<client_id>&redirect_uri=<url_encoded_registered_return_url>&scope=openid%20share&state=<random_state>&code_challenge=<base64url_sha256_challenge>&code_challenge_method=S256&response_mode=query
NoteValues are placeholders: URL-encode them when building the request. For Gateway,
for_client_ididentifies the recipient whose onboarding settings should apply and includes that recipient in the requested sharing consent. When supplied, thesharescope is required. Omit this parameter for other use cases unless your integration requires it.
Authorization request parameters
| Parameter | Required | Description |
|---|---|---|
response_type | Yes | Use code for the standard authorization code flow. |
client_id | Yes | Your OIDC client ID. |
redirect_uri | Yes | A return URL registered in OIDC Settings. |
scope | Yes | Space-separated scopes for the requested permissions. Include openid for an OIDC request. |
state | Yes | An unpredictable transaction-specific value used to match the response to the request and protect against cross-site request forgery. Reject a response with a missing or mismatched value. |
code_challenge | Yes for PKCE | The base64url-encoded SHA-256 hash of the code verifier, without padding. |
code_challenge_method | Yes for PKCE | Set to S256. |
response_mode | No | Use web_message for a popup or query for a current-tab redirect. Set this parameter explicitly. |
nonce | Recommended | A transaction-specific value checked against the ID token. |
login_hint | No | An email address to prefill; the user can edit it. |
ui_locales | No | Space-separated preferred UI language tags. |
prompt | No | Controls re-authentication or re-consent as described below. |
for_client_id | No | For recipient-specific Gateway onboarding, the recipient's client ID. Requires the share scope. |
Exchange authorization code
From your backend, exchange the authorization code at the discovered token endpoint. The standard token endpoint accepts a form-encoded request and client authentication. Keep the client secret on your backend.
Request example:
curl -X POST 'https://id.sumsub.com/api/snsId/oauth/token' \
-u '<client_id>:<client_secret>' \
-H 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=authorization_code' \
--data-urlencode 'code=<authorization_code>' \
--data-urlencode 'redirect_uri=<registered_return_url>' \
--data-urlencode 'code_verifier=<original_code_verifier>'The redirect URI must match the authorization request. Validate the ID token before using its claims. Exchange the code promptly; it is short-lived. For protocol background, see the OpenID Connect specification.
Open popup on desktop
On desktop, a popup keeps the application page visible while the user completes verification and lets that page receive the authorization response. Browsers can block popups.
- Open a blank popup synchronously in the user's click handler, before any network request.
- Navigate it to the authorization URL with
response_mode=web_message. Ifwindow.openreturnsnull, redirect the current tab withresponse_mode=query. - Keep the popup handle and do not use
noopenerornoreferrer. - Set
Cross-Origin-Opener-Policy: same-origin-allow-popups, or omit the header, on the page that opens the popup.same-origincan sever the opener relationship. - Sumsub posts messages to the origin of the registered
redirect_uri. Open the popup from a page on that origin. Accept messages only whenevent.originishttps://id.sumsub.comin Production orhttps://id-sbx.sumsub.comin Sandbox andevent.sourceis the popup you opened.
On success, the popup posts an OAUTH_SUCCESS message with the authorization response in data. In the standard authorization flow, data.redirectUri contains the registered return URL with the authorization code and state in its query parameters. Read the code from that URL and validate the returned state.
On an authorization error, the popup can post OAUTH_ERROR with error, error_description, and state. A request with an invalid or untrusted return URL cannot deliver a message to that URL.
Success message example:
{
"type": "OAUTH_SUCCESS",
"data": {
"code": null,
"state": "<your_state>",
"redirectUri": "https://app.example.com/oidc/callback?code=<authorization_code>&state=<your_state>"
}
}Validate the return URL against the registered URL, and check that both state values match the transaction before sending the code to your backend. Check popup.closed on focus or visibility changes and periodically as a fallback.
ImportantIf the popup closes before a valid response arrives, handle it as an incomplete flow. Do not assume authorization succeeded.
The following example opens a prepared URL and falls back to the current tab. Prepare and retain the transaction state and PKCE verifier before the click; authorizationUrl must contain the parameters described above:
button.addEventListener('click', () => {
const popupUrl = new URL(authorizationUrl);
popupUrl.searchParams.set('response_mode', 'web_message');
const popup = window.open('about:blank', 'sumsub_id', 'popup,width=480,height=720');
if (!popup) {
const redirectUrl = new URL(authorizationUrl);
redirectUrl.searchParams.set('response_mode', 'query');
// Preserve the transaction state and PKCE verifier before navigating.
saveTransactionForReturn();
window.location.assign(redirectUrl.toString());
return;
}
// Register a message handler before navigating the popup. Check event.origin,
// event.source and state before passing a code to your backend.
watchAuthorizationPopup(popup, expectedState);
popup.location.href = popupUrl.toString();
});saveTransactionForReturn and watchAuthorizationPopup represent functions implemented by your application. Use the Sandbox origin in Sandbox. Do not expose a client secret in frontend code.
Open current tab on mobile
On mobile, the current tab gives the flow the available screen space and avoids depending on popup behavior in mobile and in-app browsers.
- Before navigating, preserve the transaction state and verifier so the registered return page can resume the flow.
- If a mobile app opens a separate browser, ensure its return URL and transaction storage work across that transition.
- Redirect to the authorization endpoint with
response_mode=query. - On return, validate
state, handle any OAuth error, and send the authorization code to your backend for exchange. A user who closes or leaves the flow before returning requires a new authorization attempt.
Prompt parameter
The optional prompt parameter controls re-authentication or re-consent:
login— forces re-authentication.consent— forces the consent screen.none— uses the current default behavior. If the request cannot be completed silently, Sumsub shows the relevant screens. Do not combinenonewith another value.
If prompt is omitted, Sumsub uses the default behavior. The recognized values are lowercase.
Updated 13 days ago