@gj-kit/expo-auth
Token lifecycle primitives for Expo, React Native, and the web, including coordinated refresh and storage adapters.
Current npm latest:
0.1.1
Use it when
Section titled “Use it when”Use it when an app needs one reusable token refresh and persistence boundary across mobile and browser clients.
Do not use it when
Section titled “Do not use it when”Do not put application routes, identity-provider policy, telemetry, or API client ownership in the package.
Golden path
Section titled “Golden path”Outcome: One app-owned session that persists login state and coordinates concurrent refreshes.
1. Install
Section titled “1. Install”pnpm add @gj-kit/expo-auth2. Keep the app-owned boundary explicit
Section titled “2. Keep the app-owned boundary explicit”Choose the storage adapter once and connect only your refresh-endpoint callback.
3. Start with the smallest integration
Section titled “3. Start with the smallest integration”Copy this first, then replace only the app-owned values named above.
import { createAuthSession, type RefreshRequest } from '@gj-kit/expo-auth';import { createTokenStorage, createWebLocksRefreshLock } from '@gj-kit/expo-auth/storage';
declare const refresh: RefreshRequest; // Your API client classifies rotated, invalid, or transient.
export const session = createAuthSession({ storage: createTokenStorage({ keyPrefix: 'myapp.auth' }), lock: createWebLocksRefreshLock({ name: 'myapp.auth' }), refresh,});Runtime and peers
Section titled “Runtime and peers”Engines: node >=20
| Peer | Supported range | Required for |
|---|---|---|
expo-secure-store |
>=14.0.0 |
documented optional subpaths only |
Public subpaths
Section titled “Public subpaths”| Entry | Exported symbols |
|---|---|
Root entry |
19 |
./storage |
3 |
./testing |
8 |
Safety boundary
Section titled “Safety boundary”Treat tokens as secrets: use the supplied error contracts and never log token strings or raw authorization responses.
API reference
Section titled “API reference”complete API reference contains every public function, class, type, constant, and error contract generated from release declarations. Each item shows its import path, release signature, and package version.