React Native
This is a walkthrough of how you can integrate the Onboarding or Authenticate SDK for ReactNative applications.
Getting started
In order to perform an Onboarding or an Authenticate, you should follow those steps:
Set up the SDK: install and import the SDK
Get a token: request a token using your business credentials
Start an onboarding or authenticate flow and get the user workflow result from SDK: launch a user workflow and use the Message handler to get insights about the user workflow
Get the Analysis result: use your callback or the endpoint to get the analysis result
1. Set up the SDK
1.1. Project requirements
The proper functioning of the SDK necessitates the provision of several parameters. These parameters are essential for enabling the full range of functionalities offered by the SDK.
minSdk or minSdkVersion = 24
1.2. Install SDK
ShareID use Maven to provide its SDK securely with authentication managed in your AppName/android/build.gradle
file.
1.3. Add the dependency
To install the SDK, you'll need to add the dependency in your app
module.
Add the following to your
build.gradle
You can now synchronise and use the SDK in your project
Make sure you update your various dependencies, distributionUrl, IDE, gradle version or anything else.
2. Get a token
Use the credentials you received from ShareID's team to get an authenticate token and launch an onboarding or authenticate workflow.
Depending on the SDK you are integrating (Onboarding/Authenticate), you may use an API here Get a Token
3. Start an onboarding or authenticate flow and get the user workflow result from SDK
Use your token to start an onboarding or an authenticate.
Step 1: Setup your Turbo Module folders
The Turbo Module creates a bridge between your JavaScript code and native Android code, enabling you to use ShareID's specific features in React Native.
Your folder structure should look like this:
You can use the npx @react-native-community/cli init AppName
command directly into Demo folder if you are starting a new project.
Tips
To keep the Turbo module decoupled from the application, we recommend that you define it separately from the application and then add it to your application as a dependency at a later date.
Don't forget to change the AppName field
Step 2: JS module configuration
The JavaScript module acts as an interface between React Native and the native code.
Create a NativeShareID.ts file in the js:
Add a package.json file to the RTNShareID folder:
Step 3: Android configuration and Kotlin files
The Android code is used to implement the native ShareID SDK features.
Create a build.gradle file in the RTNShareID/android folder:
Add a ShareIDPackage.kt file to the RTNShareID/android/src/main/java/com/rtnshareid folder:
Add a ShareIDModule.kt file to the RTNShareID/android/src/main/java/com/rtnshareid folder:
You can use EventEmitter
to pass on our messageHandler to your React Native code.
Step 4: Import and test
Import the module into your React Native application
Go to your App.tsx (or .js) file and add this import:
To finish, launch your app with this commands
All the code above is an example of Kotlin integration. You can also use Java by referring to the Android documentation.
4. Get the Analysis result
When the processing of an onboarding request is finished, you may receive the result through the callback if you provided it. You may also, fetch yourself the result by calling our API.
See Get the analysis result for more details.
Customisation
The ShareID SDK is designed to be highly customisable, allowing great flexibility through various configuration options or the application of themes to adapt the user interface to your needs. To do this, simply follow this same section in the Android and iOS documentation and add them to your code.
Last updated