Context
Authentication has two distinct contexts that need different handling:
HA add-on via ingress — the HA supervisor authenticates all ingress traffic before it reaches the add-on. Only logged-in HA users can reach the add-on's ingress path. No additional auth is needed for the management UI when accessed this way.
Direct port / standalone Docker / MCP — requests arrive without any upstream authentication. Write endpoints and the MCP endpoint must require a valid API key.
Approach
A single API key, set by the user in configuration, protects all write endpoints and the MCP endpoint.
HA add-on
The key is set in the add-on's configuration panel (addon/config.yaml option api_key). The HA supervisor exposes it as an environment variable (Quotinator__ApiKey). No UI in the add-on itself for key management.
Standalone Docker
The same env var (Quotinator__ApiKey) is set directly, e.g. via docker run -e Quotinator__ApiKey=... or docker-compose.yml.
If no key is configured
The app starts but write endpoints and the MCP endpoint return 503 Service Unavailable with a message indicating auth is not configured. This prevents accidental open write access.
Implementation checklist
Notes
Authorization: Bearer <key> is the standard mechanism; also consider X-Api-Key as a simpler alternative for consumers that struggle with Bearer headers
- Read endpoints remain unauthenticated — Quotinator's primary use case is serving quotes to display tools
- The management UI accessed via HA ingress relies on the supervisor's authentication; no Blazor-level auth guard is needed for ingress-only deployments
Context
Authentication has two distinct contexts that need different handling:
HA add-on via ingress — the HA supervisor authenticates all ingress traffic before it reaches the add-on. Only logged-in HA users can reach the add-on's ingress path. No additional auth is needed for the management UI when accessed this way.
Direct port / standalone Docker / MCP — requests arrive without any upstream authentication. Write endpoints and the MCP endpoint must require a valid API key.
Approach
A single API key, set by the user in configuration, protects all write endpoints and the MCP endpoint.
HA add-on
The key is set in the add-on's configuration panel (
addon/config.yamloptionapi_key). The HA supervisor exposes it as an environment variable (Quotinator__ApiKey). No UI in the add-on itself for key management.Standalone Docker
The same env var (
Quotinator__ApiKey) is set directly, e.g. viadocker run -e Quotinator__ApiKey=...ordocker-compose.yml.If no key is configured
The app starts but write endpoints and the MCP endpoint return
503 Service Unavailablewith a message indicating auth is not configured. This prevents accidental open write access.Implementation checklist
api_keyoption toaddon/config.yaml(optional string, no default)addon/translations/en.yaml,nl.yaml,de.yamlQuotinator:ApiKeyfrom config inProgram.csApiKeyAuthenticationHandleror middleware that checksAuthorization: Bearer <key>on protected routesPOST,PUT,DELETEon/api/v1/quotes) and/mcp401 Unauthorizedwhen the key is missing or wrong;503or startup warning when no key is configured at allIApiLocalizermessage keys for auth error responses (with translations in all three locale files)README.mdandaddon/DOCS.mdNotes
Authorization: Bearer <key>is the standard mechanism; also considerX-Api-Keyas a simpler alternative for consumers that struggle with Bearer headers