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
| Parameter | Type | Description | Default | Required |
|---|---|---|---|---|
clientId | string | Your Revolut application client ID | - | Yes |
redirectUri | string | URI to redirect to after authentication | - | Yes |
scope | OpenIdScope[] | Array of requested OpenID scopes | - | Yes |
displayMode | popup | redirect | Authentication flow mode | redirect | No |
onAuthSuccess | (result: SuccessResult) => void | Success callback function | - | Yes (popup mode only) |
onAuthFailure | (result: ErrorResult) => void | Error callback function | - | No (popup mode only) |
mode | production | sandbox | Environment mode | production | No |
colorScheme | light | dark | auto | UI theme preference | - | No |
countryCodes | string[] | Array of allowed country codes | - | No |
locale | string | Language/locale code | - | No |
Available scopes
| Scope | Description |
|---|---|
openid | Required - Basic OpenID Connect authentication |
profile | User's basic profile information |
name | User's full name |
email | User's email address |
phone | User's phone number |
address | User's address information |
birthdate | User's date of birth |
citizenship | User'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
}
| Property | Type | Description |
|---|---|---|
status | success | Indicates successful authentication |
code | string | Authorization code from Revolut |
codeVerifier | string | PKCE verification string |
ErrorResult
Returned when authentication fails or is cancelled.
type ErrorResult = {
status: 'error'
error: ErrorType
errorDescription?: string
}
| Property | Type | Description |
|---|---|---|
status | error | Indicates authentication failure |
error | ErrorType | Specific error code |
errorDescription | string | Optional error description |
Error types
| Error Code | Description |
|---|---|
registration_not_supported | Registration flow not supported |
user_cancelled | User cancelled authentication |
access_denied | Access denied by user |
authorise_declined | Authorisation declined |
unknown | Unknown error occurred |
timeout | Authentication timed out |
interrupted | Authentication flow interrupted |
popup_blocked | Popup was blocked by browser |
popup_closed | Popup was closed before completion |
iframe_failed | iFrame authentication failed |
code_verifier_not_found | PKCE code verifier not found |
code_verifier_already_used | PKCE code verifier already used |
state_not_found | OAuth state parameter not found |