Sandbox
Help

Revolut ID Android SDK

Reference for the parameters, objects, and types available in the Revolut ID Android SDK.

For detailed instructions on how to install and integrate the SDK, see: Revolut ID SDK for Android: Integration guide.

Methods and parameters

RevolutIdAuthenticator.create factory

Creates and returns a RevolutIdAuthenticator instance. Create it once and reuse it throughout your app's session.

val authenticator = RevolutIdAuthenticator.create(
    config = RevolutIdConfig(environment = RevolutIdEnvironment.RELEASE),
    context = applicationContext,
)
ParameterDescriptionFormatRequired
configThe SDK configuration specifying the target environment.RevolutIdConfigYes
contextAndroid application context.ContextYes

RevolutIdAuthenticator.authorise method

Launches the Revolut authorisation flow and returns a RevolutIdAuthoriseResult indicating whether the flow was started. The launch target depends on the configured RevolutIdEnvironment.

fun authorise(
    clientId: String,
    scopes: String,
    redirectUri: Uri,
    state: String,
): RevolutIdAuthoriseResult
ParameterDescriptionFormatRequired
clientIdYour OAuth client ID issued by Revolut.StringYes
scopesSpace-separated list of OAuth scopes to request. Available scopes are listed in scopes_supported at the OpenID configuration endpoint.StringYes
redirectUriThe URI the user is redirected to after authorisation. Must match a URI allowlisted in your OAuth client settings.UriYes
stateCryptographically random string generated per request. The app must verify it matches the value returned in the redirect to prevent CSRF attacks.StringYes

Returns: RevolutIdAuthoriseResultSuccess if the authorisation flow was launched, otherwise an Error describing why it could not be started.

RevolutIdAuthenticator.handle method

Processes the redirect URI received when the user returns to your app after authorisation. Returns a RevolutIdHandleResult representing the outcome of the flow.

Call this in both onCreate and onNewIntent of the Activity registered with the <intent-filter> matching your redirectUri. See Declare the redirect URI for the manifest setup.

fun handle(uri: Uri): RevolutIdHandleResult
ParameterDescriptionFormatRequired
uriThe URI received from the redirect intent (intent.data).UriYes

Helper objects and types

RevolutIdConfig data class

Configuration passed to RevolutIdAuthenticator.create. Specifies the target Revolut environment.

data class RevolutIdConfig(
    val environment: RevolutIdEnvironment,
)
ParameterDescriptionFormatRequired
environmentThe environment the SDK operates in.RevolutIdEnvironmentYes

RevolutIdEnvironment enumeration

Specifies whether the SDK targets the production or sandbox Revolut environment.

enum class RevolutIdEnvironment {
    RELEASE,
    SANDBOX,
}
CaseDescription
RELEASEFor live use. Launches the Revolut app if installed, or falls back to https://sso.revolut.com. Must be paired with a production client ID.
SANDBOXFor development and testing. Always opens a browser pointing to https://sandbox-sso.revolut.com. Must be paired with a sandbox client ID. Note: the Revolut mobile app does not support sandbox mode.

The sandbox OpenID configuration is available at https://sandbox-sso.revolut.com/.well-known/openid-configuration.

Drawable resources

The SDK bundles two Revolut logo drawables for building a branded sign-in button.

ResourceUse when
@drawable/logo_revolut_blackLight backgrounds
@drawable/logo_revolut_whiteDark backgrounds

Reference them in your XML layout:

<ImageButton
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:src="@drawable/logo_revolut_black"
    android:contentDescription="@string/sign_in_with_revolut" />

Callbacks and results

RevolutIdAuthoriseResult sealed interface

Returned by RevolutIdAuthenticator.authorise(). Indicates whether the SDK successfully launched the authorisation flow.

sealed interface RevolutIdAuthoriseResult {
    data object Success : RevolutIdAuthoriseResult

    sealed interface Error : RevolutIdAuthoriseResult {
        data class InvalidParameters(val message: String) : Error
        data object RequestHandlerNotFound : Error
    }
}
CaseDescription
SuccessThe authorisation flow was successfully initiated. Wait for the redirect in your callback Activity.
ErrorThe authorisation flow could not be started. See RevolutIdAuthoriseResult.Error for the available cases.

RevolutIdHandleResult sealed interface

Returned by RevolutIdAuthenticator.handle(). Represents the final outcome of the authorisation flow.

sealed interface RevolutIdHandleResult {
    data class Success(
        val code: String,
        val codeVerifier: String,
    ) : RevolutIdHandleResult

    object Cancelled : RevolutIdHandleResult

    sealed interface Error : RevolutIdHandleResult {
        sealed interface AuthorisationFailed : Error {
            object AuthorisationNotAvailable : AuthorisationFailed
            object Timeout : AuthorisationFailed
            object Interrupted : AuthorisationFailed
            data class Unknown(val details: String?) : AuthorisationFailed
        }
        object CodeVerifierIsEmpty : Error
    }
}
CaseDescription
SuccessAuthorisation succeeded. The associated Success value contains the code and codeVerifier needed for backend token exchange.
CancelledThe user dismissed the authorisation flow without completing it.

RevolutIdHandleResult.Success data class

Contains the values your backend requires to exchange for an access token via the token endpoint.

PropertyDescriptionFormat
codeThe authorisation code received from Revolut.String
codeVerifierThe PKCE code verifier generated by the SDK. Must be sent alongside code to complete the token exchange securely.String

Errors

RevolutIdAuthoriseResult.Error sealed interface

Describes why the SDK could not launch the authorisation flow. Returned as the Error branch of RevolutIdAuthoriseResult.

CaseDescription
Error.InvalidParametersOne or more parameters provided to authorise() were invalid. The message property describes which parameter failed validation.
Error.RequestHandlerNotFoundThe SDK could not find a Revolut application or browser to handle the authorisation request.

RevolutIdHandleResult.Error sealed interface

Describes why an authorisation flow ended in failure. Returned as the Error branch of RevolutIdHandleResult.

CaseDescription
Error.AuthorisationFailed.AuthorisationNotAvailableThe user is not eligible to perform authorisation (for example, they do not have a qualifying Revolut account).
Error.AuthorisationFailed.TimeoutThe authorisation flow timed out before the user completed it.
Error.AuthorisationFailed.InterruptedThe authorisation flow was interrupted.
Error.AuthorisationFailed.UnknownAn unexpected error occurred. The optional details string may contain additional context for debugging.
Error.CodeVerifierIsEmptyhandle() was called without a preceding authorise() call.
Rate this page