mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-11 05:42:19 +00:00
When a request to `/api/auth/login` or `/api/auth/passkey/login-verify` carries `X-Client-Type: native` (or a `User-Agent` matching `HealthLog-iOS`), the response now also contains a 90-day `hlk_*` Bearer token alongside the user object. Browser sessions continue to receive the cookie only — no extra payload, no behaviour change for them. Token issuance is gated by header detection in `src/lib/auth/issue-token.ts` and re-uses the existing `ApiToken` table + HMAC pipeline; nothing new on the storage side. Audit log records `auth.token.autoissue.native` so each auto-issued token is traceable to its login event. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>