Skip to content

feat(auth): upgrade better auth to 1.7 - #1604

Merged
realcodesiman merged 5 commits into
mainfrom
feat/better-auth-1-7
Oct 31, 2026
Merged

realcodesiman merged 5 commits into
mainfrom
feat/better-auth-1-7

Conversation

@realcodesiman

Copy link
Copy Markdown
Contributor

Summary

  • Upgrade Better Auth to 1.7 to adopt its current OAuth provider and MCP resource support.
  • Keep workspace-scoped OAuth consent and token handling aligned with the updated schema.

Changes

  • Update builder and MCP OAuth routes, metadata, token introspection, and consent handling.
  • Replace OAuth application persistence with Better Auth 1.7 OAuth client/resource models and migration.
  • Refresh authentication, MCP, and schema-parity coverage; document JWT MCP access tokens.

Test plan

  • pnpm lint
  • pnpm --filter builder check-types
  • manual verification

@github-actions github-actions Bot added the feature New feature or request label Oct 30, 2026
Serve discovery against Better Auth's authorize endpoint directly instead of
the /oauth/authorize wrapper, hash existing confidential client secrets and
null empty public ones in the migration, and rely on live consent for
revocation in the public API. Move MCP config into its own auth subpath and
drop the unused verification repository.
…alid

Better Auth 1.7 reuses a stored consent without re-prompting, so a failed
workspace bind now revokes the grant instead of leaving an unbound consent.
UNAUTHORIZED APIErrors from bearer verification now map to an invalid token
(401) rather than escaping as a server error. Document the OIDC callback path
move and the MCP_PUBLIC_URL / CHATBOTX_MCP_PUBLIC_URL pairing.
@realcodesiman
realcodesiman merged commit f516c43 into main Oct 31, 2026
14 checks passed
@realcodesiman
realcodesiman deleted the feat/better-auth-1-7 branch October 31, 2026 09:01
hello-jackytruong referenced this pull request in hello-jackytruong/ChatWorkAI Nov 22, 2026
* feat(auth): upgrade better auth to 1.7

* fix(auth): harden better auth 1.7 oauth migration and mcp flow

Serve discovery against Better Auth's authorize endpoint directly instead of
the /oauth/authorize wrapper, hash existing confidential client secrets and
null empty public ones in the migration, and rely on live consent for
revocation in the public API. Move MCP config into its own auth subpath and
drop the unused verification repository.

* fix(auth): revoke unbound mcp consent and treat expired tokens as invalid

Better Auth 1.7 reuses a stored consent without re-prompting, so a failed
workspace bind now revokes the grant instead of leaving an unbound consent.
UNAUTHORIZED APIErrors from bearer verification now map to an invalid token
(401) rather than escaping as a server error. Document the OIDC callback path
move and the MCP_PUBLIC_URL / CHATBOTX_MCP_PUBLIC_URL pairing.

* fix(auth): pass request context to oauth and mcp token verification

* fix: migrate better-auth to 1.7.x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant