> ## Documentation Index
> Fetch the complete documentation index at: https://idto.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# React Native SDK

> Run the idto verification flow in a React Native or Expo app with one component.

The React Native SDK is the `IDtoVerification` component. Render it with `visible` set to `true` and it opens the idto verification flow in a modal, calling your props as each step finishes.

![Driving licence verification result screen](https://idto-sdk-usage-demo-bucket.s3.ap-south-1.amazonaws.com/docs/v1/img/sdk-dl-result.png)

A driving licence result inside the flow.

## Requirements

| Peer dependency | Version |
| - | - |
| `react` | 18.0.0 or later |
| `react-native` | 0.71.0 or later, or Expo SDK 49 or later |
| `react-native-webview` | 13.6.0 or later |
| `react-native-safe-area-context` | 4.0.0 or later |

Use a real device for document and selfie capture. You also need a `client_id` and `client_secret` (kept on your server), a `workflowTemplateId`, and a backend route that mints a client token. See [Authentication](https://idto.mintlify.site/authentication.md).

## Install

```bash theme={null}
npm install @idto/react-native-sdk react-native-webview react-native-safe-area-context
cd ios && pod install && cd ..
```

The current version is `0.2.5`. To let users save the result report as a PDF, also install the optional `react-native-blob-util` (0.19.0 or later) and `react-native-share` (10.0.0 or later). Without them the download button does nothing and the rest of the flow is unaffected.

## Permissions

**Expo.** Add the bundled config plugin. It fills in the iOS camera and microphone usage strings and the Android `CAMERA` and `RECORD_AUDIO` permissions, and keeps any values you set yourself.

```json theme={null}
{ "expo": { "plugins": ["@idto/react-native-sdk"] } }
```

**Bare React Native.** Add the iOS keys to `Info.plist`:

```xml theme={null}
<key>NSCameraUsageDescription</key>
<string>We use the camera to verify your identity.</string>
<key>NSMicrophoneUsageDescription</key>
<string>We use the microphone during the liveness check.</string>
```

And the Android permissions to `android/app/src/main/AndroidManifest.xml` inside `<manifest>`:

```xml theme={null}
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
```

The OS asks the user the first time a camera step opens.

## Quick start

**1. Mint a client token on your server**

Your server calls `POST /auth/sdk/token` with `client_id` and `client_secret` and returns only `access_token` to the app. Recipes: [Node](https://idto.mintlify.site/recipes/sdk-token-node-express.md), [TypeScript](https://idto.mintlify.site/recipes/sdk-token-typescript.md), [Python](https://idto.mintlify.site/recipes/sdk-token-python-fastapi.md).

**2. Render the component**

```tsx theme={null}
import { useState } from 'react'
import { Button } from 'react-native'
import { IDtoVerification } from '@idto/react-native-sdk'

export function KycScreen() {
  const [visible, setVisible] = useState(false)
  const [clientToken, setClientToken] = useState<string | null>(null)

  const start = async () => {
    const r = await fetch('https://your-server.example.com/api/idto-token', { method: 'POST' })
    setClientToken((await r.json()).client_token)
    setVisible(true)
  }

  return (
    <>
      <Button title="Verify your identity" onPress={start} />
      {clientToken && (
        <IDtoVerification
          visible={visible}
          clientToken={clientToken}
          workflowTemplateId="your-workflow-template-uuid"
          businessName="Sample Traders"
          env="production"
          onStepComplete={(d) => console.log('step', d.step)}
          onWorkflowComplete={(d) => confirmOnServer(d.session_token)}
          onError={(d) => console.error(d.step, d.error)}
          onAbandon={() => setVisible(false)}
          onClose={() => setVisible(false)}
        />
      )}
    </>
  )
}
```

Your app owns `visible`. Set it to `false` in `onClose` and `onAbandon`. Props are read once per open, so close and reopen to apply new values, and wait for `onClose` before reopening.

**3. Confirm the result on your server**

Callbacks drive your UI only. Confirm the session from your server with the [session result recipe](https://idto.mintlify.site/recipes/confirm-session-result.md) or a signed [webhook](https://idto.mintlify.site/concepts/webhooks.md) before you grant access.

![Workflow complete screen](https://idto-sdk-usage-demo-bucket.s3.ap-south-1.amazonaws.com/docs/v1/img/sdk-workflow-complete.png)

The completion screen shown after the last step.

## Props

### Required

| Prop | Type | Purpose |
| - | - | - |
| `visible` | `boolean` | Opens the flow when `true`. |
| `clientToken` | `string` | The `access_token` your server minted. |
| `workflowTemplateId` | `string` | UUID of the workflow to run. |

### Optional

| Prop | Type | Purpose |
| - | - | - |
| `getToken` | `() => Promise<string>` | Returns a fresh client token when the current one expires. |
| `sessionToken` | `string` | Resume an earlier session. |
| `startFresh` | `boolean` | Start a new session even if one is in progress. |
| `merchantUserId` | `string` | Your own id for this user. |
| `phone` | `string` | Prefills the mobile number step. |
| `preVerified` | `Record<string, boolean>` | Module slugs you already verified, which the flow skips. |
| `skippable` | `string[]` | Module slugs the user may skip. See [Modules](https://idto.mintlify.site/sdks/modules.md). |
| `accumulatedData` | `object` | Data you already hold, passed into the session. |
| `referenceName` | `string` | Name every document name is matched against. |
| `nameMatchConfig` | `object` | `threshold`, `decision_mode`, `extra_honorifics`, `aliases`, `compare_pairs`. |
| `faceMatchReferenceImage` | `string` | Reference photo for face match. |
| `faceMatchConfig` | `object` | `skipLiveness`, `threshold`, `livenessFailurePolicy`. |
| `aadhaarConfig` | `object` | `digilockerMaxFailures`, `okycEnabled`. |
| `panConfig` | `object` | `skipContextScreen`. |
| `businessName` | `string` | Your name in the flow header. |
| `logo` | `string` | URL of your logo. |
| `language` | `'en'` or `'hi'` | Language of the flow copy. |
| `theme` | `'light'` or `'dark'` | Colour scheme. |
| `displayMode` | `'full_screen'` or `'bottom_sheet'` | Layout. |
| `bottomSheet` | `object` | Sheet height limits. |
| `colors` | `object` | Colour overrides. |
| `env` | `'production'` or `'development'` | `production` (default, `https://prod.idto.ai`) or `development` (staging, `https://dev.idto.ai`). |
| `baseUrl` | `string` | Overrides the API host. |
| `readyTimeout` | `number` | Milliseconds to wait for the flow to load. Default 30000. |
| `allowedHosts` | `string[]` | Extra hostnames the flow may navigate to. |
| `debug` | `boolean` | Prints the flow's log messages. |

## Callbacks

| Prop | Payload fields |
| - | - |
| `onStepComplete` | `step`, `result`, `accumulated_data`, `session_token`, `credits_deducted`, `balance_remaining` |
| `onWorkflowComplete` | `all_steps`, `accumulated_data`, `session_token` |
| `onError` | `step`, `error`, `session_token` |
| `onAbandon` | `at_step`, `reason`, `session_token` |
| `onClose` | none |

`error` is a readable message to log, not to match on. Always pass `onError` and `onAbandon`, at least as logging stubs, so failures are visible during development.

## See it run

<video controls width="100%" src="https://idto-sdk-usage-demo-bucket.s3.ap-south-1.amazonaws.com/docs/v1/video/flow-driving-licence.mp4" poster="https://idto-sdk-usage-demo-bucket.s3.ap-south-1.amazonaws.com/docs/v1/video/flow-driving-licence.jpg" />

Was this page helpful? Email us at [tech@idto.ai](mailto:tech@idto.ai?subject=Docs%20feedback%3A%20React%20Native%20SDK) with the page link.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.