Files
eatme/docs/api/auth-routes.md
Michal Pemcak fffcb73ea4 Initial commit: EatMe attendance tracker
Google-SSO PWA for bistro employee clock-in/out, admin employee
management, and stats with CSV export. Express + SQLite backend,
React + Zustand frontend in the light-mono-tui design language.
Multi-stage Dockerfile, compose.yaml for image-based deploys, nginx
reverse-proxy template, and an OKF documentation bundle in docs/.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-16 18:41:11 +02:00

1.2 KiB

type, title, description, resource, tags, timestamp
type title description resource tags timestamp
API Endpoint Auth routes POST /api/auth/google, POST /api/auth/logout, GET /api/auth/me. backend/src/routes/auth.ts
api
auth
2026-08-12T00:00:00Z

Auth routes

Mounted at /api/auth (backend/src/index.ts).

Examples

POST /api/auth/google
Body: { "credential": "<google id token>" }
200 -> { "user": SessionUser }
400 -> missing credential
401 -> invalid Google token
403 -> email not verified, or not an admin and not an active employee

Sets the eatme_session cookie on success. See Auth flow for what happens before this (role resolution) and what's inside the cookie.

POST /api/auth/logout
204, clears the session cookie. No auth required.
GET /api/auth/me
Requires a valid session cookie (requireAuth).
200 -> { "user": SessionUser }
401 -> not authenticated

SessionUser shape (backend/src/types.ts):

{ email: string; name: string | null; role: "admin" | "employee"; employeeId: number | null }

Related