fix(plugin-auth): land OAuth callback errors on the console login page (objectui#2458 item 1)#2888
Merged
Merged
Conversation
…e (objectui#2458 item 1)
better-auth redirects a failed OAuth callback (expired/replayed state, IdP
error) to its default error URL `${baseURL}/error`, which bounces to
`/?error=<code>` — and the root→console redirect drops the query string.
Net effect: a user who just signed in successfully at the IdP lands on a
silent login form (the reported "login silent failure").
Set onAPIError.errorURL to the console login page so the browser lands on
`/_console/login?error=<code>`; the console login page (objectui PR, paired)
renders that param as a visible error banner.
Refs objectstack-ai/objectui#2458 (item 1)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
📓 Docs Drift CheckThis PR changes 1 package(s): 9 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Paired with objectstack-ai/objectui#2468 (merge that UI PR first — this redirect targets the error banner it adds; without it the login page still receives the param but shows nothing, which is no worse than today).
Problem
A failed OAuth callback (expired/replayed
stateafter the 10-minute signed-params window, IdP error) redirects through better-auth's default error URL:/api/v1/auth/error?error=state_mismatch→/?error=state_mismatch. The runtime's root→/_console/redirect drops the query string, so a user who just signed in successfully at the IdP lands on a silent login form with no explanation — reproduced live as the "login silent failure" in objectui#2458 item 1.Change
Set
onAPIError.errorURLin the betterAuth config togetConsolePageUrl('/login')— the same console-page helper already used for the oidcloginPage/consentPage. better-auth's generic-oauth callback (and core error route) then lands the browser on/_console/login?error=<code>, which the console login page renders as a visible banner (objectui#2468).Unit test asserts the config wiring; full
auth-manager.test.tssuite green (171 tests). End-to-end redirect chain traced live on the run-stack rig: env callback 302 →/api/v1/auth/error?error=state_mismatch→/?error=state_mismatch(query lost today); with this change the target is the login page and the banner was verified rendering via direct navigation to/_console/login?error=state_mismatch.Refs objectstack-ai/objectui#2458 (item 1)
🤖 Generated with Claude Code