Source: ddx-documentation/research/rq3-auth-matrix.md
**Question** (BRIEF.md RQ3): what does "advanced auth V5" need that better-auth or Auth.js v5 cannot give (org plugin, teams, access control, JWT for ddx-api, API keys)? **Answer** (owner Q1, confirmed 2026-10-23): better-auth 1.7 gives every row natively. "Advanced auth V5" means feature parity with the HMS Auth.js v5 setup (credentials + WebAuthn passkey + org in session). Auth.js v5 is the rejected alternative. Decision: [ADR 0002](/en/docs/adr/0002-auth-better-auth). ## Matrix | Need | better-auth 1.7 | Auth.js v5 | Source | |---|---|---|---| | Email + password credentials | built in (`emailAndPassword`) | Credentials provider; no session DB for credentials by default | better-auth docs <https://better-auth.com/docs> (cited, not fetched 2026-10-23); Auth.js docs <https://authjs.dev> (cited, not fetched 2026-10-23) | | Organizations (multi-tenant) | `organization` plugin: orgs, members, invitations, active org on session | none built in; you build tables + callbacks | `~/.claude/ddx-topic-flows/VERSIONS.md` `betterauth1` row; R4 `~/.claude/findings/nextjs-skills-audit/research/R4-auth-org-providers-sse.md` | | Teams inside an org | `organization` plugin `teams` option | none built in | VERSIONS.md `betterauth1` ("organization plugin + teams + access control") | | Access control (roles, permissions) | `createAccessControl` + org roles | none built in; custom callbacks | VERSIONS.md `betterauth1`; R4 | | API keys (service + user scope) | `apiKey` plugin | none built in | better-auth plugin docs <https://better-auth.com/docs/plugins/api-key> (cited, not fetched 2026-10-23) | | Passkey (WebAuthn) | `passkey` plugin | WebAuthn provider (marked experimental) | better-auth <https://better-auth.com/docs/plugins/passkey>; Auth.js WebAuthn guide <https://authjs.dev/getting-started/authentication/webauthn> (cited, not fetched 2026-10-23) | | JWT / JWKS issued by the backend for ddx-api | `jwt` plugin: JWT + JWKS endpoint, verify in ddx-api guard | JWT session strategy in the Next.js app; no JWKS issuer | better-auth <https://better-auth.com/docs/plugins/jwt> (cited, not fetched 2026-10-23) | | Runs inside NestJS (ddx-api owns auth) | framework-agnostic handler; mount in Nest | built for Next.js route handlers first | better-auth docs; Auth.js docs | | Next.js integration | `nextCookies()` plugin (LAST in the list) | native | VERSIONS.md `betterauth1` row | | Harness canon for new projects | yes | legacy (existing HMS repos only) | VERSIONS.md `betterauth1` row; stack-specialist Next.js 16 rule | | Upstream activity | 1.7.11 latest on 2026-10-23 | — | <https://better-auth.com/changelog> (search excerpt 2026-10-23) | ## Gaps - No row needs a library change. API key + JWT in one ddx-api guard chain is RQ9 (a later task). - The plugin option names are from the docs above. The ddx-api scaffold task checks them against the installed `better-auth` types before wiring. ## Source note "Cited, not fetched" = the doc URL is the canonical page for the row, but this run did not open it. The row rests on the harness canon (VERSIONS.md, R4). The ddx-api scaffold task verifies each plugin against the installed package.
Question (BRIEF.md RQ3): what does "advanced auth V5" need that better-auth or Auth.js v5 cannot give (org plugin, teams, access control, JWT for ddx-api, API keys)?
Answer (owner Q1, confirmed 2026-10-23): better-auth 1.7 gives every row natively. "Advanced auth V5" means feature parity with the HMS Auth.js v5 setup (credentials + WebAuthn passkey + org in session). Auth.js v5 is the rejected alternative. Decision: .
better-auth types before wiring."Cited, not fetched" = the doc URL is the canonical page for the row, but this run did not open it. The row rests on the harness canon (VERSIONS.md, R4). The ddx-api scaffold task verifies each plugin against the installed package.
adr/
deploy/
research/