Sandbox
Help

Integrate SDK

Revolut ID Web SDK is available for integration as NPM package with full TypeScript support or as simple CDN script. Choose your preferred installation method:

NPM package

npm install @revolut/id
yarn add @revolut/id
pnpm add @revolut/id
bun add @revolut/id

or CDN script

<!-- Sandbox -->
<script src="https://sandbox-sso.revolut.com/revolut-id.js"></script>

<!-- Production -->
<script src="https://sso.revolut.com/revolut-id.js"></script>

Integration

HTML container

Specify on your HTML page container for mounting Revolut ID button

<div id="revolut-id-button-container"></div>

Initialisation and mounting

Initialisation configuration and processing auth callback depends on selected display mode popup or redirect.

Authentication opens in a popup window, user stays on the original page.

import { RevolutIdLoader } from '@revolut/id'

const revolutId = await RevolutIdLoader({ mode: 'production' })

const { mountButton } = revolutId.initialise({
  clientId: 'your-client-id',
  redirectUri: 'https://your-app.com/callback',
  scope: ['openid', 'profile', 'email'],
  displayMode: 'popup',
  onAuthSuccess: ({ code, codeVerifier }) => {
    // Send to backend for token exchange
    console.log('Success:', { code, codeVerifier })
  },
})

const container = document.getElementById('revolut-id-button-container')

const buttonClient = mountButton(container, {
  kind: 'sign_up',
  size: 'large',
  variant: 'light-outlined',
  radius: 'round',
})

If you're using the CDN script, window.revolut.id will be available globally and you can use it directly without importing RevolutIdLoader.

Unmounting

Unmount button if needed.

buttonClient.unmount()

API reference

Revolut ID Web SDK provide interface RevolutId that can be returned by RevolutIdLoader (NPM installation) or be available in global window scope via window.revolut.id.

export interface ButtonClient {
  mount: (container: HTMLElement, params?: ButtonStyle) => ButtonClient
  unmount: () => void
}

export interface RevolutId {
  initialise: (config: Config) => {
    mountButton: (container: HTMLElement, params?: ButtonStyle) => ButtonClient
  }

  processRedirectParams: () => SuccessResult | ErrorResult | null
}

Config - initialisation parameters (required)

ParameterTypeDescriptionRequired
clientIdstringYour Revolut application client IDYes
redirectUristringURI to redirect to after authenticationYes
scopeOpenIdScope[]Array of requested OpenID scopesYes
displayModepopup | redirectAuthentication display modeNo
modeproduction | sandboxEnvironment modeNo (defaults to 'production')
colorSchemeColorSchemeUI theme preferenceNo
countryCodesstring[]Array of allowed country codesNo
localestringLanguage/locale codeNo
onAuthSuccess(result: SuccessResult) => voidSuccess callback functionYes (popup mode only)
onAuthFailure(result: ErrorResult) => voidError callback functionNo (popup mode only)

For complete configuration documentation and advanced options, see Config API reference.

ButtonStyle - button styling parameters (optional)

ParameterTypeDescriptionDefaultRequired
kindcontinue | sign_in | sign_up | verify | iconButton text and purposecontinueNo
sizelarge | smallButton sizelargeNo
variantdark | light | light-outlinedVisual styledarkNo
radiusnone | default | roundCorner roundingdefaultNo

For complete button styling documentation and usage examples, see ButtonStyle API reference.

Environment setup

The environment you use must match your client environment configuration.

  • Use production mode with your production client ID for live applications
  • Use sandbox mode with your sandbox client ID for development and testing

See environment configuration for more details.

Next steps

Learn how to exchange code for user ID token - code exchange.

Rate this page