Authentication Contract
Current Choice
whatsapp-adapter-appusesSimpleAuth.whatsapp-adapter-apiuses bearer-token authentication for non-browser clients.
Scope
whatsapp-adapter-appis the user-facing module.whatsapp-adapter-apiis intended for other systems and operator tooling.whatsapp-adapter-wahais not a public auth boundary and should stay private.- Public API publication and versioning rules live in
docs/api-publication.md.
Integration Rules
whatsapp-adapter-appreadsSIMPLE_AUTH_*configuration from env.whatsapp-adapter-appstores authenticated user identity in the Flask session cookie.whatsapp-adapter-appprotects browser routes by default and keeps only a short allowlist for auth entrypoints, static assets, health checks, and the signed-out page.whatsapp-adapter-apptalks towhatsapp-adapter-apiwithAuthorization: Bearer <token>.whatsapp-adapter-appkeeps its client token inAPI_BEARER_TOKEN.whatsapp-adapter-apikeeps its token registry inwhatsapp-adapter-api/data/api-tokens.csv.whatsapp-adapter-apireads the registry path fromAPI_TOKENS_FILE.whatsapp-adapter-apitreatsGET /healthzas the only public endpoint.whatsapp-adapter-apidenies every other request by default whenAPI_AUTH_ENABLED=true.whatsapp-adapter-apiaccepts a request only when the bearer token value exactly matches a row in the CSV registry.- Public API docs must describe the HTTP bearer scheme and the expected
401and403responses for protected endpoints. - The token registry CSV header is
token,issued_to,date. - Each CSV row stores the raw token value, who it was issued to, and the issue date for operator orientation.
- Changing the token registry requires restarting
whatsapp-adapter-apiso the process reloads the file. - When
SIMPLE_AUTH_ENABLED=false,whatsapp-adapter-appallows local bootstrap access without remote auth.
Exceptions
GET /logged-outis intentionally public so the browser can show a logout confirmation page with a link back to/, which starts a fresh SimpleAuth login when needed.