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

ScopeDescription
openidRequired by OpenID Connect. Requests an ID token.
emailGrants access to the user's email address.
nameGrants access to the user's name information.
shareGrants permission to generate a Sumsub ID share token.
offline_accessGrants 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:

  1. In the Dashboard, go to Configurations → Developers → OIDC Settings.
  2. Generate a client secret and register the return URL. Configure Sandbox and Production separately.
  3. 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.

  1. Generate a unique unpredictable state and PKCE code verifier for the request. Derive code_challenge as the base64url-encoded SHA-256 hash of the verifier, without padding. Use code_challenge_method=S256. Store the verifier and state securely for the transaction.
  2. Build the authorization URL using https://id.sumsub.com/api/snsId/oauth/authorize for Production or https://id-sbx.sumsub.com/api/snsId/oauth/authorize for Sandbox. These are also listed as authorization_endpoint in the discovery documents.

    Include response_type=code, your client_id, the registered redirect_uri, the requested space-separated scope, state, code_challenge, and code_challenge_method=S256. Use the exact registered redirect URI. If you use an ID token, send a unique nonce and validate it on return.
  3. Open the URL in a desktop popup with response_mode=web_message, or in the current tab with response_mode=query. Use the current tab on mobile and when a popup is blocked.
  4. 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 same redirect_uri, the original code_verifier, and the configured client authentication.
  5. 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

Note

Values are placeholders: URL-encode them when building the request. For Gateway, for_client_id identifies the recipient whose onboarding settings should apply and includes that recipient in the requested sharing consent. When supplied, the share scope is required. Omit this parameter for other use cases unless your integration requires it.

Authorization request parameters

ParameterRequiredDescription
response_typeYesUse code for the standard authorization code flow.
client_idYesYour OIDC client ID.
redirect_uriYesA return URL registered in OIDC Settings.
scopeYesSpace-separated scopes for the requested permissions. Include openid for an OIDC request.
stateYesAn 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_challengeYes for PKCEThe base64url-encoded SHA-256 hash of the code verifier, without padding.
code_challenge_methodYes for PKCESet to S256.
response_modeNoUse web_message for a popup or query for a current-tab redirect. Set this parameter explicitly.
nonceRecommendedA transaction-specific value checked against the ID token.
login_hintNoAn email address to prefill; the user can edit it.
ui_localesNoSpace-separated preferred UI language tags.
promptNoControls re-authentication or re-consent as described below.
for_client_idNoFor 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.

  1. Open a blank popup synchronously in the user's click handler, before any network request.
  2. Navigate it to the authorization URL with response_mode=web_message. If window.open returns null, redirect the current tab with response_mode=query.
  3. Keep the popup handle and do not use noopener or noreferrer.
  4. Set Cross-Origin-Opener-Policy: same-origin-allow-popups, or omit the header, on the page that opens the popup. same-origin can sever the opener relationship.
  5. Sumsub posts messages to the origin of the registered redirect_uri. Open the popup from a page on that origin. Accept messages only when event.origin is https://id.sumsub.com in Production or https://id-sbx.sumsub.com in Sandbox and event.source is 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.

Important

If 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.

  1. Before navigating, preserve the transaction state and verifier so the registered return page can resume the flow.
  2. If a mobile app opens a separate browser, ensure its return URL and transaction storage work across that transition.
  3. Redirect to the authorization endpoint with response_mode=query.
  4. 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 combine none with another value.

If prompt is omitted, Sumsub uses the default behavior. The recognized values are lowercase.


Did this page help you?