| Filename | Latest commit message | Latest commit date |
|---|---|---|
| .. | ||
| backend | ||
| frontend | ||
| .env.example | ||
| .gitignore | ||
| package.json | ||
| pnpm-lock.yaml | ||
| pnpm-workspace.yaml | ||
| README.md | ||
TAuth SDK Vite + React Example
This example has a Vite/React frontend and a tiny Rust backend that uses the local tauth-sdk crate.
It demonstrates:
- creating a TAuth login URL with
TAuthClient::auth_url - parsing the TAuth callback with
TAuthClient::parse_callback - fetching the logged-in user's TAuth profile
- storing the session/user/app data in
backend/data/db.json - optionally syncing app data through MTP when
TAUTH_HOST_PUBLIC_KEYis set
Setup
Install frontend dependencies:
pnpm install
Copy the environment template:
cp .env.example backend/.env
Set TAUTH_PRIVATE_KEY in backend/.env. Generate keys with:
pnpm --filter @tauth-example/backend exec cargo run --bin generate_keys
For local callback testing, TAUTH_REDIRECT_URL must be reachable by TAuth. Use a tunnel if needed.
Run
Run frontend and backend together:
pnpm dev
Open http://localhost:5173 and click Login with TAuth.
Backend Endpoints
GET /api/login: redirects to TAuthGET /tauth/callback: receives TAuth callback and stores the sessionGET /api/me: returns the current cookie session and cached user dataPUT /api/app-data: saves JSON app data locally and optionally through MTP
The JSON database is intentionally simple for example purposes. Do not use it as-is for production.