@humansecurity/expo-mobile-sdk
v2.0.0
Published
An Expo module to wrap human native SDK for Expo users.
Downloads
9,754
Readme
expo-mobile-sdk
A module implementing our native SDKs for the Expo framework.
API documentation
The full Documentation and usage examples can be found at our official site.
Installation in managed Expo projects -
Version 2.x targets Expo SDK 55 and wraps HUMAN native SDK 5.0.0 on both iOS and Android.
Minimum supported app versions:
- Expo SDK 55
- React 19 / React Native 0.83
- iOS 15.1+
- Android minSdk 21, compileSdk 36, targetSdk 36
From the terminal run:
npm install @humansecurity/expo-mobile-sdkThen add the config plugin to your app.json (or app.config.js) so the Android dependency repository is automatically configured:
{
"expo": {
"plugins": [
"@humansecurity/expo-mobile-sdk"
]
}
}The config plugin also applies the Android build settings required by HUMAN Android SDK 5.0.0:
android.compileSdkVersion=36
android.targetSdkVersion=36Note: The HUMAN Android SDK 5.0.0 requires
minSdkVersion≥ 21. React Native 0.75+ already enforcesminSdkVersion24 by default, so no explicit override is needed.
Note:
The config plugin is available starting from version 1.0.8 and later.
If you are using an earlier version (1.0.2–1.0.6), do not add the plugin line — simply run:
npm install @humansecurity/expo-mobile-sdk
npx expo prebuildFinally, run the prebuild command:
npx expo prebuildUsage example
import { HumanSecurity } from '@humansecurity/expo-mobile-sdk';
//Display the version text in a tag to confirm integration:
<ThemedText type="title">{HumanSecurity.sdkVersion()}</ThemedText>
The current API:
sdkVersion(): string;
startWithAppId(appId: string, policy?: HSPolicy): Promise<void>;
startWithAppIds(appIds: string[], policy?: HSPolicy): Promise<void>;
vid(appId: string): string | null;
// BD functionality
headersForURLRequest(appId?: string): Promise<{ [key: string]: string }>;
handleResponse(response: string, code: number, url: string): Promise<HSBotDefenderChallengeResult>;
canHandleResponse(response: string, code: number, url: string): boolean;
challengeReferenceId(): string;
setCustomParameters(parameters: { [key: string]: string }, appId?: string): void;
// Adding AD functions
setUserId(userId: string | null, appId?: string): void;
registerOutgoingUrlRequest(url: string, appId?: string): void;
setAdditionalData(parameters: { [key: string]: string }, appId?: string): void;
Upgrading from 1.x to 2.x
The JavaScript API is intentionally kept compatible with 1.x. Most apps should only need to upgrade Expo to SDK 55, install @humansecurity/expo-mobile-sdk@^2, and run npx expo prebuild --clean.
Native build requirements changed because HUMAN Android SDK 5.0.0 uses compileSdk and targetSdk 36. If your app has custom Gradle configuration, make sure it does not override the values applied by the config plugin.
Installation in bare React Native projects
For the react-native bare workflow projects see our integration guide.
⚠️ Note for Custom / Bare Workflows
If your project does not use expo prebuild, you must manually add the repository entry to your android/build.gradle file. Make sure this block appears in every section where you define repositories:
allprojects {
repositories {
// ... your existing repos
maven { url 'https://jfrog.humansecurity.com/artifactory/human-android-sdk/' }
}
}The config plugin automatically adds this during expo prebuild, but in custom workflows, it must be added manually to ensure proper Android dependency resolution.
