# Methods and parameters

This document provides a detailed reference for the parameters, objects, and methods available in the Revolut ID iOS SDK.

:::info
For detailed instructions on how to install and integrate the SDK, see: [Revolut ID SDK for iOS: Integration guide](/docs/sdks/revolut-id-sdk/ios/integration-guide).
:::

## Methods and parameters

### `RevolutIdKit.configure` method

The `RevolutIdKit.configure` method sets up the SDK with the required configuration. This must be called before any other SDK usage — typically on app launch in `AppDelegate`.

```swift
RevolutIdKit.configure(
    with: RevolutIdKit.Configuration(
        environment: .production,
        logLevel: .none
    )
)
```

| Parameter       | Description                                                          | Format                                                            | Required   |
| --------------- | -------------------------------------------------------------------- | ----------------------------------------------------------------- | ---------- |
| `configuration` | The SDK configuration containing environment and log level settings. | [`RevolutIdKit.Configuration`](#revolutidkitconfiguration-object) | Yes        |

### `RevolutIdKit.shared` property

The shared singleton instance of `RevolutIdKit`. Use this to call instance methods after the SDK has been configured.

```swift
let kit = RevolutIdKit.shared
```

### `RevolutIdKit.authorise` method

Redirects the user to the Revolut app (if installed) or the Revolut web app to authorise the requested scopes. On completion, returns either credentials for token exchange, a failure reason, or a cancellation signal.

```swift
RevolutIdKit.shared.authorise(
    scope: [String],
    completion: @escaping (RevolutIdKit.AuthorisationResult) -> Void
)
```

| Parameter    | Description                                                                                                                                                                                                                                     | Format     | Required   |
| ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- | ---------- |
| `scope`      | An array of OAuth scopes to request. Available scopes are listed in `scopes_supported` at the [OpenID configuration endpoint](https://sso.revolut.com/.well-known/openid-configuration).                                                        | `[String]` | Yes        |
| `completion` | A closure called when the authorisation flow finishes. Returns an [`AuthorisationResult`](#revolutidkitauthorisationresult-enumeration) with credentials on success, a failure reason on error, or `.cancelled` if the user dismissed the flow. | `Closure`  | Yes        |

### `RevolutIdKit.handle(url:)` method

Processes the redirect URL returned by the Revolut app or web app after authorisation. Returns `true` if the URL was recognised and handled by the SDK.

Call this method in your app's URL handling delegate:

- **Modern apps (iOS 13+):** In `UISceneDelegate.scene(_:openURLContexts:)`
- **Legacy apps:** In `AppDelegate.application(_:open:options:)`

```swift
RevolutIdKit.shared.handle(url: URL) -> Bool
```

| Parameter   | Description                                                                                                | Format   | Required   |
| ----------- | ---------------------------------------------------------------------------------------------------------- | -------- | ---------- |
| `url`       | The URL received from the system when your app is opened via the custom URL scheme registered for the SDK. | `URL`    | Yes        |

### `RevolutIdKit.revolutLogoIcon24` property

A `UIImage` of the Revolut logo at 24pt, provided for constructing a sign-in button that meets Revolut brand guidelines.

```swift
let image = RevolutIdKit.shared.revolutLogoIcon24
```

## Helper objects and types

### `RevolutIdKit.Configuration` object

Configuration structure used to initialise the SDK. Pass an instance to `RevolutIdKit.configure(with:)`.

```swift
public init(
    environment: Environment,
    logLevel: LogLevel = .none
)
```

| Parameter     | Description                                              | Format                                                             | Required   |
| ------------- | -------------------------------------------------------- | ------------------------------------------------------------------ | ---------- |
| `environment` | The environment the SDK operates in.                     | [`RevolutIdKit.Environment`](#revolutidkitenvironment-enumeration) | Yes        |
| `logLevel`    | Controls the verbosity of SDK logs. Defaults to `.none`. | [`RevolutIdKit.LogLevel`](#revolutidkitloglevel-enumeration)       | No         |

### `RevolutIdKit.Environment` enumeration

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

```swift
public enum Environment {
    case production
    case sandbox
}
```

| Case          | Description                                                                                                                                                                               |
| ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `.production` | For live use. Must be paired with a production client ID.                                                                                                                                 |
| `.sandbox`    | For development and testing. Must be paired with a sandbox client ID. Note: the Revolut mobile app does not support sandbox mode — the user is redirected to the Revolut web app instead. |

:::info
The sandbox OpenID configuration is available at [https://sandbox-sso.revolut.com/.well-known/openid-configuration](https://sandbox-sso.revolut.com/.well-known/openid-configuration).
:::

### `RevolutIdKit.LogLevel` enumeration

Controls how much diagnostic output the SDK emits to the console.

```swift
public enum LogLevel {
    case none
    case warning
    case error
}
```

| Case       | Description                                          |
| ---------- | ---------------------------------------------------- |
| `.none`    | No SDK logs are emitted. Recommended for production. |
| `.warning` | Logs potential issues that do not prevent operation. |
| `.error`   | Logs only errors that affect SDK functionality.      |

## Callbacks and results

### `RevolutIdKit.AuthorisationResult` enumeration

Returned in the `completion` closure of `authorise(scope:completion:)`. Represents the final outcome of the authorisation flow.

```swift
public enum AuthorisationResult {
    case success(Credentials)
    case failure(FailureReason)
    case cancelled
}
```

| Case                      | Description                                                                                                                                                              |
| ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `.success(Credentials)`   | Authorisation succeeded. The associated [`Credentials`](#revolutidkitcredentials-object) value contains the `code` and `codeVerifier` needed for backend token exchange. |
| `.failure(FailureReason)` | Authorisation failed. The associated [`FailureReason`](#revolutidkitfailurereason-enumeration) value describes the cause.                                                |
| `.cancelled`              | The user dismissed the authorisation flow without completing it or explicitly cancels the authorisation flow.                                                            |

### `RevolutIdKit.Credentials` object

Contains the values your backend requires to exchange for an access token via the [token endpoint](https://sso.revolut.com/.well-known/openid-configuration).

| Property       | Description                                                                                                         | Format   |
| -------------- | ------------------------------------------------------------------------------------------------------------------- | -------- |
| `code`         | The authorisation code received from Revolut.                                                                       | `String` |
| `codeVerifier` | The PKCE code verifier generated by the SDK. Must be sent alongside `code` to complete the token exchange securely. | `String` |

## Errors

### `RevolutIdKit.FailureReason` enumeration

Describes why an authorisation flow ended in failure. Returned as the associated value of `.failure` in `AuthorisationResult`.

```swift
public enum FailureReason {
    case missingConfiguration
    case authorisationNotAvailable
    case timeout
    case interrupted
    case unknown(details: String?)
}
```

| Case                        | Description                                                                                                     |
| --------------------------- | --------------------------------------------------------------------------------------------------------------- |
| `missingConfiguration`      | `RevolutIdKit.configure(with:)` was not called before attempting authorisation.                                 |
| `authorisationNotAvailable` | The user is not eligible to perform authorisation (for example, they do not have a qualifying Revolut account). |
| `timeout`                   | The authorisation flow timed out before the user completed it.                                                  |
| `interrupted`               | The authorisation flow was interrupted, for example by the app moving to the background.                        |
| `unknown(details:)`         | An unexpected error occurred. The optional `details` string may contain additional context for debugging.       |