React Native SDK
This SDK allows you to integrate Reclaim's in-app verification process into your React Native application.
Prerequisites
- A Reclaim account where you've created an app and have the app id, app secret.
- A provider id that you've added to your app in Reclaim Devtools.
Note:
- This SDK may not be compatible with React Native Frameworks like Expo.
- To learn more about React Native apps without a framework, refer to the React Native documentation.
Example
- See the Reclaim Example - React Native for a complete example of how to use the SDK in a React Native application.
Installation
Alternative: Install from git source
Setup
Android Setup
Add the following to your android/app/src/main/AndroidManifest.xml
file under the <application>
tag:
add the following to the end of settings.gradle:
(Ignore if already added in settings.gradle
from above)
or alternatively add the following repositories to the relevant repositories block:
iOS Setup
- Make sure to have a platform declaration for your project in your
Podfile
with version 13.0 or higher.
Ignore if you already have this declaration in your Podfile
.
- Add the following to your
Podfile
to override SDK dependency:
- You can override the version of dependency when you wish to use a specific version of the SDK.
- You can add a declaration in your
Podfile
to install the SDK from cocoapods, or from a specific git tag, head, commit, or branch.
- After adding the dependency, your podfile may look like this:
- Run
pod install
inside the ios/ directory of your project.
Fixing performance issues on IOS physical devices
Your app performance will be severely impacted when you run debug executable on a physical device. Fixing this requires a simple change in your Xcode project xcscheme.
Method 1: Update Environment Variables for XCScheme (Recommended)
- Open your iOS project (*.xcworkspace) in Xcode.
- Click on the project target.
- Click on the Scheme dropdown.

- Click on the Edit Scheme button.
- Click on the Run tab.
- Click on the Arguments tab and check the Environment Variables section.

- Add the following environment variable:
- Key:
GODEBUG
- Value:
asyncpreemptoff=1
- Key:
- Click on the Close button in the dialog and build the project.
- Run the app on a physical device.
Method 2: Disable "Debug executable"
This method is not recommended but could be useful if you don't want to add environment variables to the xcscheme.
- Open your iOS project (*.xcworkspace) in Xcode.
- Click on the project target.
- Click on the Scheme dropdown.

- Click on the Edit Scheme button.
- Click on the Run tab.
- Uncheck the Debug executable checkbox.

Usage
To use Reclaim InApp Sdk in your project, follow these steps:
- Import the
@reclaimprotocol/inapp-rn-sdk
package in your project file.
- Initialize the
ReclaimVerification
class to create an instance.
- Start the verification flow by providing the app id, secret and provider id.
The returned result is a [ReclaimVerificationApi.Response] object. This object contains a response that has proofs, exception, and the sessionId if the verification is successful.
Exception Handling
If the verification ends with an exception, the exception is thrown as a [ReclaimVerificationApi.ReclaimVerificationException] object.
Following is an example of how to handle the exception using [error.type]:
This error also contains sessionId
, reason
, and innerError
that can be used to get more details about the occurred error.
Advanced Usage
Overriding SDK Config
Note: Overriding again will clear previous overrides
Contributing
See the contributing guide to learn how to contribute to the repository and the development workflow.
License
MIT