feat(auth): token-based admin authentication for Playwright/CI (#105)
Add POST /api/auth/token — validates ADMIN_TOKEN env var, creates a 24h session and sets the sid cookie so automated tools can access the admin panel without Google OAuth. Admin login page gains a token input form. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -8,6 +8,15 @@ Next.js 15 app. Deployed at `admin.o.alogins.net` (dev: `http://localhost:3080`)
|
||||
and checks `role === 'admin'`. First admin is seeded via `ADMIN_SEED_EMAIL` env var at API startup.
|
||||
- Admin write actions are appended to the `admin_actions` audit log in the DB.
|
||||
|
||||
## Authentication
|
||||
|
||||
Two ways to sign in:
|
||||
|
||||
| Method | How |
|
||||
|--------|-----|
|
||||
| Google OAuth | Click "Sign in with Google" on the login page |
|
||||
| Token | `POST /api/auth/token` with `{ token }` matching `ADMIN_TOKEN` env var; sets `sid` cookie valid for 24 h. Used by Playwright tests and CI automation. |
|
||||
|
||||
## Pages
|
||||
|
||||
| Route | Description |
|
||||
|
||||
Reference in New Issue
Block a user