RevolutId interface

RevolutId is main SDK interface returned by RevolutIdLoader for authentication management.

Methods

initialise(config: Config)

Initialises the authentication client with your configuration.

Parameters: config: Config - client configuration parameters

Returns: { mountButton: (container: HTMLElement, params?: ButtonStyle) => ButtonClient } - object with mountButton method

processRedirectParams()

Processes URL parameters after redirect to extract the authorisation result.

Returns: SuccessResult | ErrorResult | null

Config parameters

Configuration parameters for initializing the Revolut ID authentication client using discriminated union types.

Type definition

type BaseConfig = {
clientId: string
redirectUri: string
scope: OpenIdScope[]
colorScheme?: ColorScheme
countryCodes?: string[]
locale?: string
mode?: Mode
}

type PopupClientConfig = BaseConfig & {
displayMode: 'popup'
onAuthSuccess: (result: SuccessResult) => void
onAuthFailure?: (result: ErrorResult) => void
}

type RedirectClientConfig = BaseConfig & {
displayMode?: 'redirect'
}

export type Config = PopupClientConfig | RedirectClientConfig

Parameters

ParameterTypeDescriptionDefaultRequired
clientIdstringYour Revolut application client ID-Yes
redirectUristringURI to redirect to after authentication-Yes
scopeOpenIdScope[]Array of requested OpenID scopes-Yes
displayModepopup | redirectAuthentication flow moderedirectNo
onAuthSuccess(result: SuccessResult) => voidSuccess callback function-Yes (popup mode only)
onAuthFailure(result: ErrorResult) => voidError callback function-No (popup mode only)
modeproduction | sandboxEnvironment modeproductionNo
colorSchemelight | dark | autoUI theme preference-No
countryCodesstring[]Array of allowed country codes-No
localestringLanguage/locale code-No

Available scopes

ScopeDescription
openidRequired - Basic OpenID Connect authentication
profileUser's basic profile information
nameUser's full name
emailUser's email address
phoneUser's phone number
addressUser's address information
birthdateUser's date of birth
citizenshipUser's verified citizenship

Supported locales

bg, cs, da, de, el, en, en_US, es, es_MX, fi, fr, hr, hu, it, ja, lt, lv, nb, nl, pl, pt, pt_BR, ro, ru, sk, sv, uk

Result types

SuccessResult

Returned when authentication completes successfully.

type SuccessResult = {
status: 'success'
code: string
codeVerifier: string
}
PropertyTypeDescription
statussuccessIndicates successful authentication
codestringAuthorization code from Revolut
codeVerifierstringPKCE verification string

ErrorResult

Returned when authentication fails or is cancelled.

type ErrorResult = {
status: 'error'
error: ErrorType
errorDescription?: string
}
PropertyTypeDescription
statuserrorIndicates authentication failure
errorErrorTypeSpecific error code
errorDescriptionstringOptional error description

Error types

Error CodeDescription
registration_not_supportedRegistration flow not supported
user_cancelledUser cancelled authentication
access_deniedAccess denied by user
authorise_declinedAuthorisation declined
unknownUnknown error occurred
timeoutAuthentication timed out
interruptedAuthentication flow interrupted
popup_blockedPopup was blocked by browser
popup_closedPopup was closed before completion
iframe_failediFrame authentication failed
code_verifier_not_foundPKCE code verifier not found
code_verifier_already_usedPKCE code verifier already used
state_not_foundOAuth state parameter not found
Was this page helpful?