Skip to main content

Prerequisites

  • Node.js 18.x or higher
  • React 18.x or 19.x
  • React Native or Expo
  • A package manager: npm or yarn

1. Install the SDK

Install the SDK and its peer dependencies:
Or with Yarn:

2. Import the SDK

3. Wrap your app with OfflineAppProvider

Pass your Project ID from the Offline Dashboard. The provider initializes the SDK, restores any saved session on launch, and makes auth state available to hooks throughout your app.

Expo Router

React Native (App entry)

Optional: custom location provider

If you use proof-of-location features, pass a function that returns the device’s coordinates:

4. Verify your setup

Use the useAuth hook to read auth state. On launch, the SDK asynchronously restores a session from the stored token — check loading before treating user === null as logged out.

Session restore errors

When a stored token cannot be validated, sessionRestoreError is set with a typed reason:

5. Implement user authentication

Call loginWithModal() to open the built-in login bottom sheet. It returns void — the modal handles email OTP verification and username registration internally.

API reference

OfflineAppProvider

useAuth()

Other hooks