# Authentication in AlwaysOn Memory: OAuth 2.1, Connection Keys, SSO & Passkeys

> AlwaysOn Memory supports two MCP auth methods over HTTPS: OAuth 2.1 (PKCE S256, Dynamic Client Registration, rotating refresh tokens) for browser-approved apps, and workspace-scoped `awm_` connection keys for editors and CLIs. Both revoke globally in 0ms. Account sign-in supports email links, SSO, passwords, and passkeys.

- **Canonical HTML:** https://always-on.cloud/docs/concepts/authentication
- **Markdown Mirror:** https://always-on.cloud/docs/concepts/authentication.md
- **Public Docs MCP:** https://always-on.cloud/docs/mcp
- **Agent Skill:** https://always-on.cloud/skill.md
- **Last Updated:** 2026-12-01

## Should I use OAuth 2.1 or a connection key?

Use OAuth 2.1 for chat apps (ChatGPT, Claude, Grok, Le Chat, Perplexity, Raycast) and whenever you want zero static keys on disk in Cursor or VS Code. Use a connection key (`awm_...`) for terminal CLIs and IDEs that put static MCP headers in JSON or TOML.

| Property | Browser OAuth 2.1 (PKCE + DCR) | Connection Key (`awm_...`) |
| --- | --- | --- |
| Best for | ChatGPT, Claude, Grok, Le Chat, Perplexity, Raycast, Cursor, VS Code | Claude Code, Codex, Antigravity, Windsurf, JetBrains, Kiro, Gemini CLI, OpenCode, Zed, Cline |
| Recommended URL | `https://always-on.cloud/mcp` (or `https://always-on.cloud/t/<slug>/mcp`) | `https://always-on.cloud/t/<slug>/mcp` |
| Token format | `awm_oauth_...` access token + rotating refresh token | `awm_...` workspace-scoped Bearer token |
| Secret on disk | None (browser approval) | Stored in client config or env var (shown once at creation) |
| Active limit per workspace | 1 Free · 5 Pro Solo · 15 Team | Up to 25 active keys on every plan |
| Revocation time | 0ms global (single D1 lookup; replay revokes family) | 0ms global (single D1 lookup) |

## How does AlwaysOn's OAuth 2.1 flow work?

AlwaysOn implements OAuth 2.1 with mandatory PKCE S256, RFC 9728 Protected Resource Metadata, RFC 8414 Authorization Server Metadata, RFC 7591 Dynamic Client Registration, and RFC 9207 issuer (`iss`) checks. Refresh tokens rotate on every use, and replaying an old refresh token revokes the whole token family immediately.

- `Protected Resource Metadata`: https://always-on.cloud/.well-known/oauth-protected-resource (and /mcp, /t/<slug>/mcp)
- `Authorization Server Metadata`: https://always-on.cloud/.well-known/oauth-authorization-server (also /.well-known/openid-configuration)
- `Dynamic Client Registration`: POST https://always-on.cloud/oauth/register (and POST https://always-on.cloud/t/<slug>/oauth/register)
- `Supported scopes`: mcp:access, offline_access, openid, profile, email
- **Access token TTL**: 1 hour when issued with `offline_access` (or via universal `/mcp` with rotating refresh tokens); 30 days otherwise.
- **Instant revocation**: Revoke any connection key or browser-approved app under **Connections**—or reset your password to revoke all sessions and keys at once. Saved memories are never deleted.

### Agent Context: Agent OAuth & Bearer Token Rules

Handle 401 `WWW-Authenticate` challenges and workspace scoping strictly.

- Unauthenticated requests to `/mcp` or `/t/<slug>/mcp` return HTTP 401 with `WWW-Authenticate: Bearer realm="alwayson", resource_metadata="..."` for standard MCP OAuth discovery.
- Invalid or revoked tokens return HTTP 401 with `WWW-Authenticate: Bearer error="invalid_token", resource_metadata="..."`.
- OAuth tokens minted for `/mcp` bind to that resource audience; sending a token to another workspace returns HTTP 403 (`CROSS_TENANT_FORBIDDEN` or `RESOURCE_MISMATCH`).
- Never paste an `awm_` or `awm_oauth_` token into a memory page—credentials don't belong in project memory.

## How do I sign in to the AlwaysOn web dashboard?

You can sign in to the dashboard with an email magic link, SSO (Google, GitHub, GitLab, or custom OpenID Connect), a 12+ character password, or a WebAuthn passkey. Add or remove passkeys and linked SSO providers anytime under **Account**.

- **Email magic link:** One-click sign-in link sent to your email address—no password required.
- **SSO providers:** Sign in with Google, GitHub, GitLab, or OpenID Connect when configured on the deployment.
- **WebAuthn passkeys:** After signing in once, register a hardware or device passkey under **Account** for 1-tap passwordless sign-in.
- **Password reset:** Resetting your password revokes all active browser sessions, connection keys, and OAuth tokens immediately.

## Related Documentation

- [MCP protocol](https://always-on.cloud/docs/reference/mcp-protocol.md): Technical specification for AlwaysOn Memory's Streamable HTTP MCP endpoints (/mcp, /t/<slug>/mcp, /docs/mcp), protocol versions, headers, and .well-known discovery.
- [Team access](https://always-on.cloud/docs/concepts/team-access.md): Invite up to 5 teammates on AlwaysOn Team, issue per-seat connection keys, grant per-project read or write access, and share handoffs safely.
- [Security & privacy](https://always-on.cloud/docs/security/architecture.md): How AlwaysOn Memory isolates each workspace in its own SQLite Durable Object, redacts secrets before storage, encrypts data, and structures its subprocessors and Polar billing.
- [All 18 AI tools](https://always-on.cloud/docs/clients.md): Compatibility matrix for connecting AlwaysOn Memory to 18 AI coding editors, terminal CLIs, and chat apps over Streamable HTTP MCP.
