Cross-platform auth building blocks:
- Google auth-code sign-in (client gets a one-time
authCode, server exchanges it) - Redis-backed OTP + session primitives (server-side)
- Token storage + refresh helpers for mobile clients
- Site wall for password-gating prototypes (stateless, no Redis)
- Domain-locked sign-in (restrict enabled auth methods to allowed email domains)
TypeScript (Bun/Node)
npm install @crown-dev-studios/simple-auth-server-ts@crown-dev-studios/simple-auth-server-ts(packages/simple-auth-server-ts)- Redis OTP/session + Google exchange
Python
pip install -e packages/simple-auth-server-python
# or
uv pip install -e packages/simple-auth-server-pythonsimple-auth-server(packages/simple-auth-server-python)- Async Python equivalent
npm install @crown-dev-studios/simple-auth-react-native
npm install @crown-dev-studios/google-auth
# peer dependency
npm install expo-secure-store@crown-dev-studios/simple-auth-react-native(packages/simple-auth-react-native)- Token store + token manager
- Expo config plugin export:
.../plugin - Provider subpath export:
.../google
@crown-dev-studios/google-auth(packages/google-auth)- Native module that returns a one-time Google
authCodefor your server to exchange
- Native module that returns a one-time Google
Add via Package.swift or Xcode → File → Add Package Dependencies, pointing to this repo.
GoogleAuthNative(packages/google-auth-native-ios) — Google Sign-In wrapper that returnsauthCodeSimpleAuthNative(packages/simple-auth-native-ios) — token store + token manager + API client
Include as local modules in settings.gradle (see Android guide for setup):
google-auth-native-android(packages/google-auth-native-android) — Google auth-code flowsimple-auth-native-android(packages/simple-auth-native-android) — token store + token manager + API client
npm install @crown-dev-studios/simple-auth-shared-types@crown-dev-studios/simple-auth-shared-types(packages/shared-types) — Zod schemas + server config schema
| Guide | Description |
|---|---|
| Configuration Reference | Full SimpleAuthServerConfig schema, env var mapping, OTP bypass code |
| Server SDK | TypeScript + Python usage snippets for every service |
| React Native Client | Token manager, authenticated fetch, Google auth integration |
| Android Native | Gradle setup, GoogleAuthClient, TokenManager, integration example |
| Google Auth | Google auth-code flow across all platforms |
| Credentials & Storage | What to persist in your database, token rotation strategy |
| Troubleshooting | Common issues and fixes |
- Client calls Google sign-in and receives
authCode(one-time). - Client sends
authCodeto your app server (e.g.POST /auth/oauth/google). - Server exchanges
authCodewith Google, finds/creates a user, then mints your own tokens. - Client stores tokens and refreshes when needed.
- TypeScript server (
examples/server-ts/index.ts) — Full auth flow with Hono: email OTP, phone OTP, Google OAuth (3-way response), session resume, token refresh. Uses in-memory stores as DB placeholders. - Python server (
examples/server-python/app.py) — Equivalent FastAPI server with the same route set.
# From repo root first (examples use workspace packages)
pnpm install
# TypeScript (requires Redis running)
# Copy examples/server-ts/.env.example to .env and set JWT_SECRET (e.g. openssl rand -base64 32)
cd examples/server-ts && bun install && bun run dev
# Python (requires Redis running)
# Copy examples/server-python/.env.example to .env and set JWT_SECRET
cd examples/server-python && pip install -r requirements.txt && pip install -e ../../packages/simple-auth-server-python && uvicorn app:apppnpm install
pnpm typecheck # compile/type-check all packages
pnpm build # build all packages with a build scriptPython package build (uv):
uv run --with build python -m build packages/simple-auth-server-pythonpnpm test:unit