Authentication
Harmony accepts two credentials, both live:
| Caller | Mechanism | Carries | Status |
|---|---|---|---|
| Browser / dashboard | next-auth.session-token cookie | A (user, workspace, role) resolved per request | live |
| Programmatic (CLI / MCP / agents / A2A) | Authorization: Bearer hk_… | A single workspace (grants admin) | live |
Every /api/* route resolves the workspace context from whichever is present. A request carrying a valid Authorization: Bearer hk_… is authenticated as that key's workspace; otherwise the session cookie is used. Owner-only actions stay session-only even with a key (a key grants admin, not ownership).
Browser sessions
Sign in at /sign-in with email (magic link) or a configured OAuth provider. Auth.js sets next-auth.session-token; the browser sends it automatically. You don't manage it directly.
Sign-in providers
| Provider | Status | Notes |
|---|---|---|
| Email (magic link) | live | Sent from [email protected] via the Groupany mail platform. |
| code-ready | Set AUTH_GOOGLE_ID / AUTH_GOOGLE_SECRET. | |
| Microsoft Entra ID | code-ready | Set AUTH_MICROSOFT_ENTRA_ID_ID / AUTH_MICROSOFT_ENTRA_ID_SECRET. |
| GitHub | code-ready | Set AUTH_GITHUB_ID / AUTH_GITHUB_SECRET. |
OAuth buttons appear on /sign-in only when their secrets are present.
API keys (Bearer tokens)
For everything outside the browser — the CLI, MCP, your own agents, and inbound A2A calls — use a Bearer key:
Authorization: Bearer hk_live_<id>_<secret>
A key is scoped to one workspace and carries that workspace's identity. You still name the workspace in the path (/api/v1/workspaces/{slug}/…); the key must match that slug or the request is rejected with forbidden.
Minting a key
Mint keys from the dashboard: Workspace → API keys → New key. The full hk_live_… value is shown once, at creation — copy it then; only its hash is stored, so it can't be recovered. Lost a key? Revoke it and mint a new one. (There is no HTTP minting endpoint; keys are created through the dashboard.)
Key shape
hk_<env>_<24-char-id>_<32-char-secret>
hk_— the Harmony prefix that marks a Bearer value as one of ours.<env>—live(production). Atestenvironment is reserved but not yet implemented.<id>— public; stored for fast lookup and shown in the keys list.<secret>— never stored, never logged; only the SHA-256 hash is kept.
A request with a malformed or revoked key returns 401 unauthorized; a valid key aimed at the wrong workspace returns 403 forbidden.
Curl examples
# Programmatic — the Bearer key authenticates and selects the workspace
curl https://platform.groupany.ai/api/v1/workspaces/acme-research/agents \
-H "Authorization: Bearer $HARMONY_KEY"
# Start a run with a key
curl -X POST https://platform.groupany.ai/api/v1/workspaces/acme-research/sessions \
-H "Authorization: Bearer $HARMONY_KEY" \
-H "Content-Type: application/json" \
-d '{ "agent": "research-agent", "input": "Summarise today'\''s AI-policy news." }'
# Browser — the session cookie authenticates the dashboard
curl https://platform.groupany.ai/api/me \
-b "next-auth.session-token=$COOKIE"