Skip to main content
@glinr/theauth-expo brings theAuth auth to React Native and Expo apps. It stores session tokens in any storage adapter you choose. AsyncStorage, SecureStore, or your own, and sends them via Authorization header rather than cookies.

Installation

You also need a storage library. The most common choices:

Setup

1

Wrap your app

The storage prop accepts any object with getItem, setItem, and removeItem methods, the same interface as AsyncStorage and expo-secure-store.
2

Use the hooks

Secure token storage

For production apps, use expo-secure-store to keep the session token in the Keychain (iOS) or Keystore (Android):
A mobile app opens the system browser with a PKCE challenge, theAuth returns a one-time code through a deep link, and the app exchanges it and stores the token securely.

Mobile sign-in with the system browser and a one-time code.

Social sign-in

The app opens the provider in the system browser, and the server sends the browser back to your app with a single-use code. The app trades that code, together with a PKCE verifier that never left the device, for a session. The session token is never placed in a URL.
1

Allow your app's redirect URI on the server

Matching is exact. Without mobile, the mobile flow is off.
2

Configure the provider in the app

3

Call the hook

If the user has a required second factor, signInWithProvider returns a failure whose message names the gate (two_factor_required). Complete the factor, then sign in again. The mount path in basePath must expose the OAuth plugin routes /auth/oauth/authorize/:provider and /auth/oauth/mobile/exchange. The OAuth provider’s own redirect URI stays your server callback, not the app link.

Refresh on foreground

Pass React Native’s AppState as appState and the session is re-checked every time the app comes back to the foreground, so a session revoked elsewhere signs the user out.

Passkeys

Pass a platform authenticator and the provider can sign users in with a passkey and add one to a signed-in account. The server’s passkey routes already return WebAuthn JSON options and a session token, so react-native-passkey works as is:
registerPasskey needs a session, so call it after another sign-in method. Your app’s associated domains (iOS) and Digital Asset Links (Android) must list the relying party ID the server uses. A required second factor comes back as a failure naming the gate, the same as social sign-in.

Custom fetch (DPoP, pinning)

Every request the provider makes goes through config.fetch when set. Pass a DPoP client’s fetch from @glinr/theauth-client to attach proofs, or your own pinned-certificate implementation:
React Native has no crypto.subtle by default, so supply one (for example react-native-quick-crypto) and generate the key pair with it. Session tokens are plain bearer tokens on the server today, so proofs are useful for OAuth and MCP access tokens you also send through this fetch.

Hooks reference

useSession

useUser

useSignIn

useSignUp

Email and password

By default signIn and signUp call the username routes. Set emailPassword: true in the provider config to call the core email and password routes instead (POST {basePath}/auth/email/sign-in and /auth/email/sign-up, body field email), served when the server sets the emailPassword config (see Email and password).
With email verification on (the default) signUp resolves to data.verificationRequired === true and the user stays signed out. A sign-in before verification fails with code: "EMAIL_NOT_VERIFIED". The verify and reset steps are plain POST calls to /auth/email/verify and /auth/email/reset-password, usually from the web page the emailed link opens, so the Expo provider does not wrap them.

useSignOut

useAgents

Manages agent identity records for the current user. Requires the full base URL (same as the provider config).

AuthExpoConfig

The default in-memory storage loses the session when the app restarts. Always pass a real storage adapter in production.

React

Hooks and components for web React apps.

Client SDK

Framework-agnostic fetch client for non-React environments.

Sessions

Session model details including JWT token refresh flows.

OAuth providers

Configure social sign-in providers for the OAuth redirect flow.
Last modified on October 19, 2026