@humansecurity/expo-mobile-sdk
v1.0.8
Published
An Expo module to wrap human native SDK for Expo users.
Downloads
3,229
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 -
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"
]
}
}Note:
The config plugin is available starting from version 1.0.7 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): { [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;
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.
