Files
better-auth/packages
Gustavo Valverde d309e5d2ba fix(oauth): forward hook errors and sync linked profiles on rewritten callback (#9702, #9788, #8758)
Re-applies three main fixes onto next's rewritten OAuth callback, which
now routes generic-oauth through the shared callback route.

- #9702/#9788: a before-callback hook that rejects sign-in (the banned-user
  guard is the flagship case) now redirects to the per-flow errorURL
  carrying the hook's machine-readable code and message, instead of
  surfacing a raw error response. handleOAuthUserInfo is wrapped in
  try/catch; the hook's APIError code is forwarded verbatim (it is
  app-defined, not a member of OAUTH_CALLBACK_ERROR_CODES) via next's
  local redirectOnError closure. The admin plugin's stale inline /callback
  redirect is removed so the banned-user path flows through that single
  forwarder and emits BANNED_USER with a URL-encoded description.
- #8758: accountLinking.updateUserInfoOnLink now applies on the explicit
  OAuth link path, not only id-token linking.

The regression tests (banned social sign-in emits error=BANNED_USER, the
cross-origin errorCallbackURL case, and the 403-JSON id-token case) arrived
via the merge and were red on the baseline; these source changes make them
pass.

(cherry picked from commit 1d893ae572277447025e29462946a7aeb11443ac)
2026-05-31 00:10:35 +01:00
..
2026-05-09 19:28:11 +00:00
2026-05-31 00:10:16 +01:00
2026-05-31 00:10:16 +01:00
2026-05-31 00:10:16 +01:00
2026-05-29 22:28:58 +01:00
2026-05-31 00:10:16 +01:00
2026-05-31 00:10:16 +01:00
2026-05-29 22:28:58 +01:00
2026-05-29 22:28:58 +01:00