Repository navigation
feat: silent prompt=none and prompt=login re-auth in the hosted authorize UI - #3203
Conversation
…rize UI (plan 042) The server GET /authorize cannot silently authenticate (auth is header-only; a top-level navigation carries no bearer), so prompt=none is handled in the hosted SSR kit Authorize.vue — the page every RP is redirected to — after the router guard resolves the session: - prompt=none: not-logged-in / realm-mismatch -> redirect redirect_uri?error=login_required; non-built_in client -> consent_required; built_in + logged-in + realm-match -> the existing auto-consent issues the code silently; every error redirect is gated on redirectUriVerified (unverified -> degrade to interactive UI, never redirect an OIDC error to an unregistered URI). New AuthorizeSilentRedirect.vue performs the client-only navigation. - prompt=login: forces the login form with a re-auth banner (authupClient.reauthText, added across all 4 locales) even for a logged-in user, until a fresh LOGGED_IN; the same path handles a mid-flow login_required (replacing the old silent switchAccount). - discovery re-adds `none` to prompt_values_supported. Covered by kit specs (silent redirect per error code, verified-uri gate, built_in success, re-auth banner) + the discovery e2e.
|
Note Reviews pausedUse the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughOIDC discovery now advertises ChangesSilent/Re-auth prompt handling
Estimated code review effort: 4 (Complex) | ~60 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
authup
@authup/client-web
@authup/server-core
@authup/access
@authup/client-web-kit
@authup/client-web-kit-theme
@authup/client-web-nuxt
@authup/client-web-theme
@authup/core-http-kit
@authup/core-kit
@authup/core-realtime-kit
@authup/errors
@authup/i18n
@authup/kit
@authup/server-adapter-kit
@authup/server-adapter-node
@authup/server-adapter-socket-io
@authup/server-adapter-web
@authup/server-kit
@authup/server-test-kit
@authup/specs
commit: |
…consent UI (audit follow-up) Under a silent (prompt=none) built_in request, an auto-consent POST failure other than login_required set autoConsentFailed=true and dropped to the full interactive manual-consent screen — violating the zero-UI contract. Add a `silent` prop + `failed` emit to AuthorizeForm: in silent mode a non-login_required failure emits `failed`, and Authorize.vue redirects error=interaction_required to the RP. Also removes the unused REAUTH_TITLE i18n key and documents that prompt=none must be a top-level navigation (the authorize page denies framing).
|
@coderabbitai full review |
✅ Action performedFull review finished. |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/client-web-kit/src/components/workflows/authorize/AuthorizeSilentRedirect.vue (1)
37-47: 🔒 Security & Privacy | 🔵 Trivial | 💤 Low valueConsider adding
error_descriptionto the redirect URL.The component sets
errorandstatebut omitserror_description. While the OIDC spec makes it optional, including a brief description (e.g., matching the error code semantics) helps RPs display meaningful messages to end users. Theabort()function inAuthorizeForm.vue(line 101-105) already setserror_descriptionfor consistency.
↗️ Optional: add error_descriptiononMounted(() => { const url = new URL(props.redirectUri); url.searchParams.set('error', props.error); + url.searchParams.set('error_description', props.error); if (props.state) { url.searchParams.set('state', props.state); }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/client-web-kit/src/components/workflows/authorize/AuthorizeSilentRedirect.vue` around lines 37 - 47, The silent redirect flow in AuthorizeSilentRedirect.vue only forwards error and state, so update the onMounted redirect URL construction to also set error_description using the same error context as the abort() flow in AuthorizeForm.vue. Keep the change localized to the URL assembly in AuthorizeSilentRedirect and ensure the new parameter is included whenever props.error is present.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In
`@packages/client-web-kit/src/components/workflows/authorize/AuthorizeSilentRedirect.vue`:
- Around line 37-47: The silent redirect flow in AuthorizeSilentRedirect.vue
only forwards error and state, so update the onMounted redirect URL construction
to also set error_description using the same error context as the abort() flow
in AuthorizeForm.vue. Keep the change localized to the URL assembly in
AuthorizeSilentRedirect and ensure the new parameter is included whenever
props.error is present.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 85b6b568-1475-4114-b76a-4d6d58f0579e
📒 Files selected for processing (14)
.agents/architecture.mdapps/server-core/src/adapters/http/controllers/entities/realm/module.tsapps/server-core/test/unit/http/controllers/entities/realm-openid.spec.tsdocs/src/guide/development/api-oauth2.mdpackages/client-web-kit/src/components/workflows/authorize/Authorize.vuepackages/client-web-kit/src/components/workflows/authorize/AuthorizeForm.vuepackages/client-web-kit/src/components/workflows/authorize/AuthorizeSilentRedirect.vuepackages/client-web-kit/test/unit/components/workflows/authorize-form-silent.spec.tspackages/client-web-kit/test/unit/components/workflows/authorize.spec.tspackages/i18n/src/catalogs/de/client.tspackages/i18n/src/catalogs/en/client.tspackages/i18n/src/catalogs/es/client.tspackages/i18n/src/catalogs/fr/client.tspackages/i18n/src/constants.ts
…ent → code redirect) The built_in silent-success path was only exercised with AuthorizeForm stubbed. Add a test driving the real AuthorizeForm: built_in + silent + a successful POST /authorize navigates window.location to the returned code URL with zero interactive UI — closing the last uncovered branch of the prompt=none ladder.
…orizeForm
Consistency with the dead-bearer branch: reuse the kit's transport-agnostic
extractErrorContext helper rather than a hand-rolled `(e as {...}).response`
cast for the login_required check.
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
@coderabbitai full review |
✅ Action performedFull review finished. |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
packages/client-web-kit/test/unit/components/workflows/authorize.spec.ts (1)
239-250: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsider testing the logged-in + unverified
redirect_uri+ auto-consent failure pathThe existing "degrades to interactive UI" test uses
loggedIn: false, which shows the login form. It doesn't cover the edge case where a logged-in user with a built_in client and unverifiedredirect_urihits an auto-consent failure — the infinite spinner scenario flagged inAuthorize.vue. SinceAuthorizeFormis stubbed here, consider adding a test that simulatesonFailedemission and asserts the form doesn't get stuck in a spinner state.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/client-web-kit/test/unit/components/workflows/authorize.spec.ts` around lines 239 - 250, The current `authorize.spec.ts` coverage for the unverified `redirect_uri` path only exercises the logged-out login form flow and misses the logged-in auto-consent failure case that can leave `Authorize.vue` stuck spinning. Add a test in the `mountAuthorize`/`AuthorizeForm` suite that uses a logged-in built-in client with `redirectUriVerified: false`, triggers the form’s `onFailed` emission, and asserts the UI recovers from the spinner state instead of remaining blocked; reference the existing `degrades to interactive UI when the redirect_uri is not verified` test and the `silentRedirect`/`AuthorizeForm` stubs when wiring it up.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/client-web-kit/src/components/workflows/authorize/Authorize.vue`:
- Around line 102-111: The silent-flow handling in Authorize.vue can get stuck
on a spinner when redirectUriVerified is false because AuthorizeForm is still
mounted with silent=true and handleLoginRequired always sets silentErrorCode.
Update the Authorize component so the silent prop passed to AuthorizeForm is
gated by redirectUriVerified, and change handleLoginRequired to avoid setting
LOGIN_REQUIRED for unverified redirect URIs so the flow can fall back to the
interactive UI. Keep the fallback logic aligned with silentRedirect, onFailed,
and autoConsentFailed so the form can re-render instead of remaining in the
spinner state.
---
Nitpick comments:
In `@packages/client-web-kit/test/unit/components/workflows/authorize.spec.ts`:
- Around line 239-250: The current `authorize.spec.ts` coverage for the
unverified `redirect_uri` path only exercises the logged-out login form flow and
misses the logged-in auto-consent failure case that can leave `Authorize.vue`
stuck spinning. Add a test in the `mountAuthorize`/`AuthorizeForm` suite that
uses a logged-in built-in client with `redirectUriVerified: false`, triggers the
form’s `onFailed` emission, and asserts the UI recovers from the spinner state
instead of remaining blocked; reference the existing `degrades to interactive UI
when the redirect_uri is not verified` test and the
`silentRedirect`/`AuthorizeForm` stubs when wiring it up.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 6cc9b4bb-da23-439f-b527-995cbe6b4bbc
📒 Files selected for processing (14)
.agents/architecture.mdapps/server-core/src/adapters/http/controllers/entities/realm/module.tsapps/server-core/test/unit/http/controllers/entities/realm-openid.spec.tsdocs/src/guide/development/api-oauth2.mdpackages/client-web-kit/src/components/workflows/authorize/Authorize.vuepackages/client-web-kit/src/components/workflows/authorize/AuthorizeForm.vuepackages/client-web-kit/src/components/workflows/authorize/AuthorizeSilentRedirect.vuepackages/client-web-kit/test/unit/components/workflows/authorize-form-silent.spec.tspackages/client-web-kit/test/unit/components/workflows/authorize.spec.tspackages/i18n/src/catalogs/de/client.tspackages/i18n/src/catalogs/en/client.tspackages/i18n/src/catalogs/es/client.tspackages/i18n/src/catalogs/fr/client.tspackages/i18n/src/constants.ts
|
@coderabbitai pause |
✅ Action performedReviews paused. |
…alls back to interactive UI An unverified redirect_uri cannot receive an OIDC error, so a silent (prompt=none) auto-consent failure dead-ended on AuthorizeForm's frozen spinner: the parent set silentErrorCode, silentRedirect() returned null, and the render fell back to the same still-mounted AuthorizeForm whose onMounted never re-fired. Gate the AuthorizeForm `silent` prop and handleLoginRequired's silent LOGIN_REQUIRED redirect on redirectUriVerified so an unverified URI degrades to interactive manual consent / the login form, per the documented contract.
Plan 042 item 10. Independent of the other branches — off master.
Why it's kit-side, not server-side
The plan sketched a server-side
prompt=noneerror redirect. Investigation showed the server cannot silently authenticate onGET /authorize: the authorization middleware reads the identity only from theAuthorizationheader (andcors.tsexplicitly relies on "no cookie-authenticated endpoint exists"), while a top-level browser navigation to/authorizecarries no bearer. The session lives client-side (the kit store's cookie). So the decision belongs in the hosted SSR page —Authorize.vue, which every RP (kit or not) is redirected to. This also keeps the header-only-auth invariant intact and avoids the consent-anchor design (plan 043).The SSR app's router guard
await store.resolve()s the session before the page renders, so the kit ladder can trustloggedIn/realmIdat mount.prompt=none(silent)Evaluated before any interactive UI:
redirect_uri?error=login_required&statebuilt_inclient →consent_required(no persisted consent record yet)built_in+ logged-in + realm-match → the existing auto-consent path issues thecodesilently; alogin_requiredfrom the POST (max_age/freshness backstop) is redirected aslogin_requiredredirectUriVerified— an unverifiedredirect_uridegrades to the interactive UI (never redirect an OIDC error to an unregistered URI)New
AuthorizeSilentRedirect.vueperforms the client-onlywindow.locationnavigation inonMounted(SSR renders a "redirecting" placeholder).prompt=login(re-auth)Forces the login form — with a re-auth banner (
authupClient.reauthText, added across en/de/fr/es; locale-parity test green) — even for a logged-in user, until a fresh login on this page firesLOGGED_IN. The same banner path replaces the old silentswitchAccountwhen the POST surfaceslogin_requiredmid-flow, so a forced re-auth is now explained to the user instead of a bare form flip.Discovery
Re-adds
nonetoprompt_values_supported(it is now genuinely handled).Tests
Kit specs: silent redirect per error code (login_required / consent_required), the verified-URI degrade-to-UI gate, the built_in silent-success path, and the prompt=login banner + proceed-on-LOGGED_IN. Discovery e2e updated. Full kit suite (25) + server-core suite (1153) green.
Not in scope (documented): the
built_insilent success still relies on the kit's client-side auto-consent trust boundary — a server-side consent record is plan 043.Summary by CodeRabbit
prompt=none) and re-auth (prompt=login).none.max_agebehavior.promptparameter guidance for silent and re-auth behavior.