All Products
Search
Document Center

ID Verification:React Native integration

Last Updated:Jul 09, 2026

The ID Verification plugin adds remote KYC verification to your React Native app, covering dependency setup, SDK initialization, and authentication with sample code.

Configure Dependencies

Integrate the plugin by following the official React Native documentation or the steps below.

Download the SDK

Go to Client SDK release notes to download the ID Verification React Native SDK. Extract the ZIP to get the react-native-idv-library folder.

Add the Local Module

Add the react-native-idv-library folder as a local module to your React Native project.

Place it alongside your app project:

Development/
├── App/                      # Your React Native app root directory
└── react-native-idv-library/ # Extracted SDK local module

In your app root directory (App/), run:

yarn add ../react-native-idv-library 

Install Native Dependencies

The SDK includes native code. Configure each platform:

  • Android:
    React Native 0.60+ autolinks native modules. No extra steps needed.































































































































  • iOS:
    In your app's ios directory, run CocoaPods to install native dependencies:































































































































    cd ios
    bundle exec pod install

Start Integration

Initialize the SDK

Call install(): Promise<void> or installWithOptions(options: Object): Promise<void> to initialize the SDK. Run this as early as possible after app startup.

The options parameter, which is null by default, specifies optional data collection settings.

Important
  • The ID Verification client includes a built-in security module known as the device helper. The device helper provides various data reporting regions to meet local data collection compliance requirements. You can set CustomUrl and CustomHost to specify different reporting sites based on user attributes.

  • Only one data reporting region can be specified per application session lifecycle. The region for server-side queries must match the reporting region. The supported regions vary by product. For more information, see Supported regions.

  • For each region, the CustomUrl is as follows:

    • China (Hong Kong): https://cloudauth-device.cn-hongkong.aliyuncs.com

    • Singapore: https://cloudauth-device.ap-southeast-1.aliyuncs.com

    • Indonesia (Jakarta): https://cloudauth-device.ap-southeast-5.aliyuncs.com

    • US (Silicon Valley): https://cloudauth-device.us-west-1.aliyuncs.com

    • Germany (Frankfurt): https://cloudauth-device.eu-central-1.aliyuncs.com

    • Malaysia (Kuala Lumpur): https://cloudauth-device.ap-southeast-3.aliyuncs.com

Parameter

Description

Example

IPv6

Indicates whether to use an IPv6 domain name to report device information:

  • 0 (default): No (uses an IPv4 domain name)

  • 1: Yes (uses an IPv6 domain name)

"1"

DataSwitch

Controls when to report device information:

  • 0 (default): When the SDK initializes

  • 1: When you obtain a token

Note

The default setting is recommended.

"1"

CustomUrl

Sets the server domain name for data reporting.

See CustomUrl for each region.

CustomHost

Sets the server host for data reporting.

"cloudauth-device.ap-southeast-1.aliyuncs.com"

Note

This example is for the Singapore region. For server hosts in other regions, see CustomUrl for each region.

Example:

import IdvLibrary from 'react-native-idv-library';

IdvLibrary.installWithOptions({
  CustomUrl:"https://cloudauth-device.ap-southeast-5.aliyuncs.com",
  CustomHost:"cloudauth-device.ap-southeast-5.aliyuncs.com"});

Get MetaInfo

getMetaInfo(): Promise<string> returns the client environment context. Pass the result to your server to obtain a transactionId and Protocol from Alibaba Cloud.

Example:

import IdvLibrary from 'react-native-idv-library';

async function handleGetMetaInfo() {
  // Get metadata
  const _metaInfo = await IdvLibrary.getMetaInfo();
  console.log('Meta info:', _metaInfo);
}

Start Authentication

Call verify(transactionId: string, extParams?: Object): Promise<VerifyResult> to start verification.

Parameters:

  • transactionId: Required.

  • Extension parameters:

    View extParams options for Android and iOS native SDKs

    Android

    Key

    Description

    Example (String type)

    IdentityParams.OcrResultButtonColor

    Button color on the OCR result page.

    #FF0000

    IdentityParams.RoundProgressColor

    Circle color during face scanning.

    #FF0000

    IdentityParams.ShowBlbumIcon

    Show album upload entry during OCR:

    • 1 (default): Show

    • 0: Do not show

    1

    IdentityParams.ShowOcrResult

    Show OCR recognition result page:

    • 1 (default): Show

    • 0: Do not show

    1

    IdentityParams.EditOcrResult

    OCR result page editable:

    • 1 (default): Editable

    • 0: Not editable

    1

    IdentityParams.MaxErrorTimes

    Maximum retries.

    Range: 3–10. Default: 10.

    10

    IdentityParams.CardOcrTimeOutPeriod

    OCR recognition timeout.

    Range: 20–60 seconds. Default: 20 seconds.

    20

    IdentityParams.FaceVerifyTimeOutPeriod

    Liveness detection timeout.

    Range: 20–60 seconds. Default: 20 seconds.

    20

    IdentityParams.OcrResultTimeOutPeriod

    OCR result page edit timeout, in seconds.

    Default: unlimited.

    60

    IdentityParams.SdkLanguage

    You can customize the display language for the SDK. By default, the SDK uses your mobile device's system language.

    Note

    For a list of supported languages, see Customize languages for the Android and iOS SDKs.

    zh-Hans

    IdentityParams.CloseButtonLayout

    Layout of the Close button:

    • left (default): Left side

    • right: Right side

    left

    IdentityParams.WaterMark

    Watermark text displayed after successful OCR.

    Test watermark text

    IdentityParams.Protocol

    Protocol string from the server-side Initialize API response.

    Note

    Pass the protocol value from the server-side Initialize API response to reduce internal API calls and improve performance.

    None

    iOS

    Key

    Description

    Example (string)

    kIdentityParamKeyNextButtonColor

    Color of the bottom button on the OCR recognition result page.

    #FF0000

    kIdentityParamKeyRoundProgressColor

    Color of the circular progress indicator during the face scan.

    #FF0000

    kIdentityParamKeyOcrSelectPhoto

    Whether to show the photo album upload option during ID OCR recognition:

    • 1 (default): Show

    • 0: Do not show

    1

    kIdentityParamKeyShowOcrResult

    Whether to show the recognition result page after ID OCR recognition:

    • 1 (default): Show

    • 0: Do not show

    1

    kIdentityParamKeyEditOcrResult

    Whether the recognition result page is editable during ID OCR recognition:

    • 1 (default): Editable

    • 0: Not editable

    1

    kIdentityParamKeyMaxRetryCount

    Maximum number of retries. Valid values: 3 to 10. Default value: 10.

    10

    kIdentityParamKeyCardOcrTimeOutPeriod

    Timeout for OCR recognition, in seconds. Valid values: 20 to 60. Default value: 20.

    20

    kIdentityParamKeyFaceVerifyTimeOutPeriod

    Timeout for liveness detection, in seconds. Valid values: 20 to 60. Default value: 20.

    20

    kIdentityParamKeyCardOcrEditTimeOutPeriod

    Duration (in seconds) that the OCR recognition result page remains editable. Valid values: 60 to 180. By default, the duration is unlimited.

    180

    kIdentityParamKeyLanguage

    SDK display language. By default, the SDK uses the system language.

    Note

    For a list of supported languages, see Customize languages for the Android and iOS SDKs.

    zh-Hans

    kIdentityParamKeyDefaultLanguage

    Default SDK language. For valid values, refer to kIdentityParamKeyLanguage.

    The default value is en (English).

    en

    kIdentityParamKeyCloseButtonPosition

    Position of the close button in the SDK UI:

    • left (default)

    • right

    left

    kIdentityParamKeyWatermark

    Watermark text displayed after successful OCR recognition.

    Test watermark text

    kIdentityParamKeyProtocol

    Pre-fetched SDK protocol content.

    Note

    Obtain the protocol from the server-side Initialize API and pass it here to reduce internal SDK API calls and improve startup performance.

    968412EB*******...

    Note

    Each transactionId is single-use. Reusing one returns a fault.

  • Return value: Promise<VerifyResult>. VerifyResult contains these fields:

    • code: The status code.

    • subCode: The subcode.

    • message: The error description.

    Status codes and subcodes are listed in the Android IdentityResponse.code table and iOS error codes.

  • Example:

    import { Platform} from 'react-native';
    import IdvLibrary from 'react-native-idv-library';
    
    async function handleVerify() {
      const extParams = Platform.select({
        ios: {
          kIdentityParamKeyLanguage: 'en',
          kIdentutyParamKeyProtocol:'xxxxxxx'
        },
        android: {
          SdkLanguage: 'en',
          Protocol:'xxxxxxxxx'
        },
      });
      // Verification API
      const result = await IdvLibrary.verify('transactionId', extParams); // Replace transactionId with the actual verification ID obtained from the server.
      console.log('Verify result:', result);
    }

Customize the UI

Call setCustomUIConfig(param: string): Promise<string> to customize UI colors.

  • params: JSON string. Platform-specific UI options:

  • Example:

    async function handleSetCustonUiConfig() {
      const config= "{\"faceConfig\":{ \"faceBGColor\": \"#FF33FF\"}}";
      const result=await IdvLibrary.setCustomUIConfig(config);
      console.log('handleUi:', result);
    }

Platform-Specific Configuration

The SDK requires camera and network permissions. Configure each platform accordingly:

Android

Add AAR Files

image.png

Copy the libs folder from react-native-idv-library/android to your project's android/app directory:

image.png

Add the following to your project's android/app/build.gradle:

// Add new
repositories {
    flatDir {
        dirs 'libs'
    }
}

dependencies {
    // Add new
    implementation fileTree(dir: 'libs', include the following: ['*.aar'])

}

Obfuscation Rules

-dontwarn com.idvlibrary.**
-keep class com.idvlibrary.** {
*;
}
-verbose
-keep class com.idv.identity.platform.api.** {*;}
-keep class com.idv.identity.platform.log.** {*;}
-keep class com.idv.identity.util.IdentityUtils {*;}
-keep class com.idv.identity.ocr.IdentityOcrApi {*;}
-keep class com.idv.identity.platform.model.** {*;}
-keep class com.idv.identity.platform.config.** {*;}
-keep class com.idv.identity.face.IdentityFaceApi {*;}


-keep class com.face.verify.intl.** {*;}
-keep class com.alibaba.fastjson.** {*;}
-keep class face.security.device.api.** {*;}
-keep class net.security.device.api.** {*;}
-keep class com.dtf.toyger.** { *; }
-dontwarn net.security.device.api.**
-dontwarn face.security.device.api.**


-keep class com.idv.identity.service.algorithm.** {*;}
-keep class com.idv.identity.base.algorithm.** {*;}
-keep class com.idv.identity.quality.QualityRouter {*;}
-keep class com.idv.identity.blink.BlinkRouter {*;}
-keep class com.idv.identity.service.IdentityFaceService {*;}
-keep class com.idv.identity.service.ocr.IdentityDocService {*;}

-keep class com.alibaba.sdk.android.oss.** { *; }
-dontwarn okio.**
-dontwarn org.apache.commons.codec.binary.**



# NFC
-keep class com.idv.identity.nfc.IdentityNfcApi { *; }
-keep class org.jmrtd.** {*;}
-keep class net.sf.**{*;}
-keep class org.**{*;}
-keep class cn.**{*;}


# Please add these rules to your existing keep rules to suppress warnings.
# This is generated automatically by the Android Gradle plugin.
-dontwarn com.fasterxml.**
-dontwarn com.google.**
-dontwarn java.applet.Applet
-dontwarn java.awt.**
-dontwarn javax.**
-dontwarn org.**
-dontwarn retrofit2.**
-dontwarn springfox.documentation.spring.web.json.Json

# Log obfuscation (optional)
-assumenosideeffects class android.util.Log {
    public static *** d(...);
}

# If using versions earlier than 1.3.2, add these rules
-keepattributes Signature
-keepattributes *Annotation*
-keep class com.alibaba.fastjson.** { *; }
-keep class * extends com.alibaba.fastjson.TypeReference { *; }

iOS

Add Required Permissions

Add these permissions to Info.plist (descriptions are for reference only):

image.png

Complete Example Code

import React from 'react';
import { Platform,Text, View, StyleSheet, Button } from 'react-native';

import IdvLibrary from 'react-native-idv-library';

IdvLibrary.installWithOptions({
  CustomHost:"cloudauth-device.cn-hongkong.aliyuncs.com",
  CustomUrl:"https://cloudauth-device.cn-hongkong.aliyuncs.com"
})
export default function App() {
  const [resultInfo, setValue] = React.useState<string | null>(null);

  async function handleVerify() {

    const extParams = Platform.select({
      ios: {
        kIdentityParamKeyLanguage: 'en',
        kIdentutyParamKeyProtocol:'xxxxxxx'
      },
      android: {
        SdkLanguage: 'en',
        Protocol:'xxxxxxxxx'
      },
    });
    // Verify identity
    const result = await IdvLibrary.verify('transactionId', extParams);// Replace transactionId with the real ID from your server.
    console.log('Verify result:', result);
    
    setValue(JSON.stringify(result));
  }

  async function handleGetMetaInfo() {
    // Get metadata
    const _metaInfo = await IdvLibrary.getMetaInfo();
    console.log('Meta info:', _metaInfo);
    setValue(_metaInfo);
  }

  async function handleSetCustonUiConfig() {
    const config= "{\"faceConfig\":{ \"faceBGColor\": \"#FF33FF\"}}";

    const result=await IdvLibrary.setCustomUIConfig(config);

    console.log('handleUi:', result);
  }

  return (
    <View style={styles.container}>
      <Text>Result : {resultInfo}</Text>
      <Button title="Get Verification Info" onPress={handleGetMetaInfo} />
      <Button title="Set UI" onPress={handleSetCustonUiConfig} />
      <Button title="Verify" onPress={handleVerify} />
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    alignItems: 'center',
    justifyContent: 'center',
  },
});

Go to Client SDK release notes to download the React Native Demo.

Important

For reference only. Use the latest SDK version in production.