mirror of
https://github.com/better-auth/better-auth.git
synced 2026-07-28 17:42:01 -05:00
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)