Authenta React Native SDK
The Authenta SDK provides tools for integrating media analysis, liveness verification, deepfake detection, face similarity, and face embedding workflows into React Native applications.
The SDK is available as two packages:
| Package | Description |
|---|---|
@authenta/core | TypeScript API client for React Native and Node.js |
@authenta/react-native | React Native camera capture component built on top of @authenta/core |
GitHub Repository: https://github.com/phospheneai/authenta-reactnative-sdk
Installation
React Native Applications
Install the React Native SDK:
npm install @authenta/react-nativeInstall required peer dependencies:
npm install react-native-vision-camera react-native-image-pickerHeadless / Custom UI Integration
Install the core SDK:
npm install @authenta/coreAuthentication & Initialization
Create an AuthentaClient instance.
import { AuthentaClient } from '@authenta/react-native';
const client = new AuthentaClient({
api_key: 'YOUR_API_KEY',
auth_enabled: true,
baseUrl: 'https://platform.authenta.ai',
});Configuration
| Property | Required | Description |
|---|---|---|
api_key | Yes | Authenta API key |
auth_enabled | No | Enables authenticated requests |
baseUrl | No | Defaults to https://platform.authenta.ai |
Quick Start
The AuthentaCapture component provides a complete verification workflow including:
- Camera permissions
- Image and video capture
- Upload handling
- Processing
- Result polling
- Result display
import React, { useState } from 'react';
import { AuthentaClient, AuthentaCapture } from '@authenta/react-native';
const client = new AuthentaClient({
api_key: 'YOUR_API_KEY',
auth_enabled: true,
});
export default function App() {
const [captureOpen, setCaptureOpen] = useState(false);
return (
<AuthentaCapture
client={client}
modelType="FI-1"
visible={captureOpen}
livenessCheck={true}
faceswapCheck={false}
faceSimilarityCheck={false}
onClose={() => setCaptureOpen(false)}
onResult={(media) => console.log(media)}
onError={(err) => console.error(err.message)}
/>
);
}Verification Helpers
The SDK provides high-level verification methods.
Liveness Detection
const result = await client.verify_liveness(imageUri);
console.log(result.isSpoof);Face Swap Detection
const result = await client.verify_deepfake(videoUri);
console.log(result.isDeepFake);Face Similarity
const result = await client.verify_similarity(
selfieUri,
referenceUri
);
console.log(result.isSimilar);
console.log(result.similarityScore);Face Embeddings
const result = await client.verify_face_embeddings(imageUri);
console.log(result.faceVector);Upload & Poll in a Single Call
The simplest API is:
const result = await client.uploadAndPoll(
fileUri,
modelType
);This automatically performs:
Upload
↓
Finalize
↓
Poll
↓
Fetch Resultsand returns the processed result.
Advanced Workflow
For complete control, use the low-level APIs.
const media = await client.upload(
fileUri,
modelType
);
await client.finalizeMedia(media.jobId);
const result = await client.pollResult(
media.jobId
);
const detection = await client.getResult(result);Processing Flow
uploadAndPoll()
1. upload()
├─ createMedia()
└─ uploadToS3()
2. finalizeMedia()
3. pollResult()
4. getResult()The SDK automatically handles:
- Upload URL generation
- File uploads
- Job finalization
- Polling
- Result retrieval
Available Client Methods
High-Level APIs
| Method | Description |
|---|---|
uploadAndPoll() | Upload, finalize, poll, and fetch results |
verify_liveness() | Face liveness verification |
verify_deepfake() | Face swap detection |
verify_similarity() | Face similarity verification |
verify_face_embeddings() | Generate face embeddings |
Low-Level APIs
| Method | Description |
|---|---|
upload() | Upload media |
finalizeMedia() | Finalize uploaded media |
pollResult() | Wait for job completion |
getResult() | Fetch processed results |
createMedia() | Create media record |
getMedia() | Retrieve media |
listMedia() | List uploaded media |
deleteMedia() | Delete media |
get_task_id() | Resolve model type to task ID |
Which Package Should I Use?
| Scenario | Package |
|---|---|
| React Native app with built-in camera UI | @authenta/react-native |
| React Native app with custom camera UI | @authenta/core |
| Node.js backend or scripts | @authenta/core |
Error Handling
onError={(error) => {
console.error(error);
}}The SDK exposes typed errors and structured API responses to simplify error handling and debugging.
Next Steps
For advanced workflows, integration tests, runnable examples, and the complete API reference, visit:
https://github.com/phospheneai/authenta-reactnative-sdk
You can also explore:
uploadAndPoll()examples- Face liveness verification
- Face similarity verification
- Face embedding generation
- Media CRUD operations
- Full React Native demo application
