# Manual integration

If your integration runs in a web client, use the [JavaScript SDK](/docs/sdks/revolut-id-sdk/web/integrate-sdk/java-script). It is the supported way to integrate Revolut ID in the browser and handles the authorisation request, PKCE, and the popup and redirect flows for you.

If you integrate from a backend, a broker, or any other environment without a browser page that can mount the SDK, you can implement the flow yourself. Revolut ID is a standard OAuth 2.0 Authorisation Code flow with PKCE (RFC 7636), so any OpenID Connect relying party can integrate by building the authorisation request and exchanging the code itself, as described on this page.

Before you begin, [configure your OAuth client](/docs/sdks/revolut-id-sdk/web/configure-client). You need its client ID, its client secret, and a registered redirect URI.

## Endpoints

| Purpose | Production | Sandbox |
| --- | --- | --- |
| Authorisation | `https://sso.revolut.com/signin` | `https://sandbox-sso.revolut.com/signin` |
| Token | `https://sso.revolut.com/api/token` | `https://sandbox-sso.revolut.com/api/token` |
| Userinfo | `https://sso.revolut.com/api/userinfo` | `https://sandbox-sso.revolut.com/api/userinfo` |
| Discovery | `https://sso.revolut.com/.well-known/openid-configuration` | `https://sandbox-sso.revolut.com/.well-known/openid-configuration` |
| JWKS | `https://sso.revolut.com/api/jwks.json` | `https://sandbox-sso.revolut.com/api/jwks.json` |

:::note
Always use the host that matches the environment your client is registered in. A sandbox client only works against the sandbox host, and vice versa.
:::

## Authorisation request

Redirect the user's browser to the authorisation endpoint with these query parameters:

| Parameter | Required | Description |
| --- | --- | --- |
| `response_type` | Yes | Must be `code`. |
| `client_id` | Yes | Your client ID from the Revolut Business portal. |
| `redirect_uri` | Yes | Absolute URI registered on your client. It must match exactly, including scheme, host, and path. |
| `scope` | Yes | Space-separated list of scopes, for example `openid profile email`. See [available scopes](/docs/sdks/revolut-id-sdk/web/configure-client#available-scopes). |
| `code_challenge` | Yes | PKCE challenge derived from your `code_verifier` (see below). |
| `code_challenge_method` | Yes | Must be `S256`. |
| `state` | Recommended | Opaque value echoed back to your `redirect_uri`. Use it to carry your own request context and to protect against CSRF. |
| `nonce` | Optional | Up to 16 characters: letters, digits, or underscores. It is validated but currently not echoed back in the ID token, so do not rely on it in the code flow. |
| `claims` | Optional | URL-encoded JSON for [verified identity claims](/docs/sdks/revolut-id-sdk/web/verified-claims) (OIDC4IDA). |
| `ui_locales` | Optional | BCP 47 language tag or a space-separated preference list, for example `en-GB en fr`. |
| `country_codes` | Optional | Space-separated ISO 3166-1 alpha-2 codes restricting the countries offered for sign-in. |

### Generating the PKCE pair

```javascript
import crypto from 'crypto'

// 43 characters from the unreserved set
const codeVerifier = crypto.randomBytes(32).toString('base64url')

const codeChallenge = crypto
  .createHash('sha256')
  .update(codeVerifier)
  .digest('base64url')
```

Keep the `code_verifier` server-side, keyed to the browser session — you need it exactly once, at the token exchange.

### Building the URL

```javascript
const claims = {
  userinfo: {
    verified_claims: {
      verification: {
        trust_framework: null,
        time: null,
      },
      claims: {
        given_name: null,
        age_over_18: null,
      },
    },
  },
}

const authorizeUrl = new URL('https://sso.revolut.com/signin')

authorizeUrl.searchParams.set('response_type', 'code')
authorizeUrl.searchParams.set('client_id', process.env.REVOLUT_CLIENT_ID)
authorizeUrl.searchParams.set('redirect_uri', 'https://your-app.com/callback')
authorizeUrl.searchParams.set('scope', 'openid profile')
authorizeUrl.searchParams.set('state', state)
authorizeUrl.searchParams.set('code_challenge', codeChallenge)
authorizeUrl.searchParams.set('code_challenge_method', 'S256')
authorizeUrl.searchParams.set('claims', JSON.stringify(claims)) // omit unless requesting verified claims
```

Then redirect the user to `authorizeUrl`.

## Handling the callback

On success, the browser lands on your `redirect_uri` with an authorisation code:

```text
https://your-app.com/callback?code=...&state=...
```

Before doing anything else, validate the `state` value against what you sent:

```javascript
const url = new URL(request.url)
const code = url.searchParams.get('code')
const state = url.searchParams.get('state')

if (state !== expectedState) {
  throw new Error('State mismatch, possible CSRF')
}
```

Exchange the code immediately — authorisation codes are single-use and short-lived. Continue with [Code exchange](/docs/sdks/revolut-id-sdk/web/code-exchange) for the token request, ID token claims, and verification.

## Error handling

When a failure occurs after the request is validated, the browser is redirected back to your `redirect_uri` with the standard OAuth error parameters:

```text
https://your-app.com/callback?error=access_denied&error_description=...&state=...
```

| Parameter | Description |
| --- | --- |
| `error` | Standard OAuth error code, for example `access_denied` |
| `error_description` | Human-readable details |
| `state` | The `state` value you sent |

:::warning
If `client_id` or `redirect_uri` fail validation, the user is shown an error page at Revolut instead of being redirected — there is nothing safe to redirect to. Treat a missing callback as a configuration error.
:::

## What's next

- [:ArrowExchange: Code exchange](/docs/sdks/revolut-id-sdk/web/code-exchange "Exchange the code for tokens, verify the ID token, and call userinfo")
- [:DocumentChecked: Verified identity claims](/docs/sdks/revolut-id-sdk/web/verified-claims "Request OIDC4IDA verified claims with document evidence")
- [:CodeRepository: OIDC configuration](/docs/sdks/revolut-id-sdk/web/api-reference/openid-configuration "Discovery endpoints and the discovery document")