Authentication¶
User authentication¶
OAuth providers¶
Users log in via OAuth 2.0:
- Microsoft (Entra ID)
- GitHub
- Twitter / X
Flow:
GET /api/v1/auth/{provider}→ redirect to provider consent- Provider redirects back with
code POST /api/v1/auth/{provider}/exchangewith{code, state}→ tokens- Server sets httpOnly cookies (
lorika_access,lorika_refresh)
Tokens¶
- Access token — JWT, 15 min TTL, contains
sub(user id) +org(org id) - Refresh token — JWT, 7 days TTL, with version counter for rotation
Refreshing¶
POST /api/v1/auth/refresh — uses httpOnly cookie automatically.
Agent authentication¶
Agents use HMAC-signed requests with device tokens (SHA-256 hashed server-side).
Headers:
X-Device-Token: <token>— identifies deviceX-Timestamp: <unix>— request timestamp (anti-replay)X-Signature: <hmac>— HMAC-SHA256 of{timestamp}\n{body}
The token is issued once during enrollment (POST /api/v1/devices/enroll) and never shown again.
Multi-factor¶
Not yet enforced in v1. Planned for v2.