Hawcx React Native SDK with Smart Connect
Bring Hawcx Smart Connect to React Native using our production iOS and Android SDKs.
Overview
The Hawcx React Native SDK delivers the same Smart Connect passwordless experience that powers our native apps. The package wraps the production Hawcx iOS and Android frameworks so you can orchestrate registration and login through a single JavaScript API.
Smart Connect Technology
One-click intelligent authentication that automatically determines user context
Contextual Intelligence
No more "Sign Up" vs "Sign In" confusion - just one smart entry point
Seamless Cross-Platform
Smart Connect maintains user context across all devices and platforms
Enterprise-Grade Security
Production iOS cryptography and secure storage surfaced to React Native
Client-Side Simplicity
Hooks and helpers remove the need to juggle callbacks manually
Unified Native SDKs
The React bridge delegates to the same production Swift and Kotlin SDKs that power our mobile apps
Architecture
The TypeScript surface forwards every security-critical operation to the same HawcxSDK code that runs inside our production iOS and Android apps.
Quick Start
- Add the package to your React Native project (pin to the latest published version):
npm install @hawcx/[email protected]- Declare the pod dependency in your
ios/Podfileso native builds stay in sync with the npm package:
pod 'HawcxReactNative', '1.0.2' # or use '~> 1.0' for minor updates- Install iOS pods so the bundled
HawcxFramework.xcframeworklinks correctly:
cd ios && pod install- Open the
ios/*.xcworkspacein Xcode and build once so the native module is registered. - Keep your project API key and tenant base URL handy—you'll pass both to
initialize()during app bootstrap. The base URL is the host we provisioned for your environment (example:https://hawcx-api.hawcx.com). Do not append/hc_auth; the native SDK adds all endpoint paths automatically.
The Podspec included in the package automatically embeds the latest Hawcx framework; no manual framework copying is required. CocoaPods will pick up the right pod when you run pod install.
- Install the package:
npm install @hawcx/[email protected]. - Ensure your Android project targets minSdkVersion 26 or higher.
- Add the Hawcx Maven repository so Gradle can download the native SDK (no more local
.aarcopies):
dependencyResolutionManagement {
repositories {
google()
mavenCentral()
maven {
url = uri("https://raw.githubusercontent.com/hawcx/hawcx_android_sdk/main/maven")
}
}
}repositories {
google()
mavenCentral()
maven { url "https://raw.githubusercontent.com/hawcx/hawcx_android_sdk/main/maven" }
}
dependencies {
api "api.hawcx:hawcx:5.1.0"
// ...existing dependencies
}The hosted Maven repo is public—no GitHub token is required. If you mirror the artifacts internally, point these blocks at your own URL instead.
- If your project still contains
android/libs/hawcx-*.aarorflatDir { dirs 'libs' }, remove them—Gradle now resolves the SDK entirely through Maven.
- Sync/clean once so Gradle resolves the dependency:
cd android && ./gradlew clean assembleDebug --refresh-dependencies- Rebuild with
npm run android(or Android Studio). React Native autolinking registers the Kotlin module automatically—no manual edits toMainApplicationare needed. - Keep the same Hawcx project API key and tenant base URL available; the TypeScript initialization call is identical on Android.
import { useEffect } from 'react';
import { initialize, addAuthListener } from '@hawcx/react-native-sdk';
export async function bootstrapHawcx() {
await initialize({
projectApiKey: 'YOUR_API_KEY',
baseUrl: 'https://your-tenant.hawcx-api.hawcx.com',
});
const subscription = addAuthListener((event) => {
if (event.type === 'auth_error') {
console.warn('Hawcx error', event.payload);
}
});
return () => subscription.remove();
}Call bootstrapHawcx() once (e.g., inside your root provider). All subsequent API calls—authenticate, hooks, or helper clients—reuse the same native singleton.
baseUrl must be the scheme + host that Hawcx provisioned for your tenant (for example https://hawcx-api.hawcx.com).
Do not pass OAuth client credentials to initialize. Those values belong on your backend only; the mobile SDK should receive authorization codes and forward them for verification.
The same initialization code runs on Android. The Kotlin bridge proxies every call to the Hawcx Android SDK, so call initialize() once during app bootstrap (e.g., inside your root component or Redux saga), passing the same projectApiKey + baseUrl, and reuse hooks/listeners across screens just like iOS.
Core Features
The React SDK exposes the same Smart Connect authentication flow as our native apps: a single method (authenticate) handles login vs registration, and OTP collection happens only when the backend requires additional verification. The sections below mirror the native documentation with React-specific guidance.