Skip to content

fix(plugin-auth): land OAuth callback errors on the console login page (objectui#2458 item 1)#2888

Merged
os-zhuang merged 1 commit into
mainfrom
claude/login-oauth-error-url
Jul 13, 2026
Merged

fix(plugin-auth): land OAuth callback errors on the console login page (objectui#2458 item 1)#2888
os-zhuang merged 1 commit into
mainfrom
claude/login-oauth-error-url

Conversation

@os-zhuang

Copy link
Copy Markdown
Contributor

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 state after 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.errorURL in the betterAuth config to getConsolePageUrl('/login') — the same console-page helper already used for the oidc loginPage/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.ts suite 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

…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>
@vercel

vercel Bot commented Jul 13, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
spec Ready Ready Preview, Comment Jul 13, 2026 8:55pm

Request Review

@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/plugin-auth.

9 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:

  • content/docs/deployment/production-readiness.mdx (via @objectstack/plugin-auth)
  • content/docs/getting-started/cli.mdx (via @objectstack/plugin-auth)
  • content/docs/kernel/services-checklist.mdx (via @objectstack/plugin-auth)
  • content/docs/permissions/authentication.mdx (via @objectstack/plugin-auth)
  • content/docs/permissions/sso.mdx (via @objectstack/plugin-auth)
  • content/docs/plugins/index.mdx (via @objectstack/plugin-auth)
  • content/docs/plugins/packages.mdx (via @objectstack/plugin-auth)
  • content/docs/releases/implementation-status.mdx (via @objectstack/plugin-auth)
  • content/docs/releases/v9.mdx (via @objectstack/plugin-auth)

Advisory only. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs origin/main → pass the list as args.docs.

@os-zhuang
os-zhuang merged commit 1a28543 into main Jul 13, 2026
16 checks passed
@os-zhuang
os-zhuang deleted the claude/login-oauth-error-url branch July 13, 2026 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant