Repository navigation
feat: retain the id_token in the kit store & round-trip client-web logout - #3201
Conversation
…gout (plan 042) The kit store discarded the grant response's id_token, so no kit RP could pass an id_token_hint to the authup end_session_endpoint — every logout degraded to the click-gated confirm page. - add an `idToken` ref to the store (ID_TOKEN_UPDATED dispatcher event, CookieName.ID_TOKEN persistence, cleared in cleanup); applyTokenGrantResponse retains the existing value when a response carries none (refresh grants) - client-web pages/logout.vue now performs the RP-initiated round-trip: it drops REQUIRED_LOGGED_OUT (so the interceptor no longer logs out before the page runs), captures idToken/realmId, runs the local-only store.logout(), then redirects to buildEndSessionURL(...) with the id_token hint and a post_logout_redirect_uri back to /login store.logout() stays local-only — the round-trip ends the shared authup session, never a DELETE /sessions/@me (which would collide with #3191 session reuse).
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (8)
📝 WalkthroughWalkthroughAdds ChangesPersist and use id_token for RP-initiated logout
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant Browser
participant LogoutPage as logout.vue
participant Store as client-web-kit Store
participant EndSessionEndpoint as /logout endpoint
Browser->>LogoutPage: mount /logout
LogoutPage->>Store: read idToken, realmId
LogoutPage->>Store: store.logout()
Store-->>LogoutPage: local tokens/cookies cleared
LogoutPage->>EndSessionEndpoint: redirect with id_token_hint, postLogoutRedirectUri
sequenceDiagram
participant Client
participant Store
participant Dispatcher
participant Cookies
Client->>Store: token grant response (login/refresh)
Store->>Store: set idToken if response.id_token present, else retain previous
Store->>Dispatcher: emit ID_TOKEN_UPDATED(idToken)
Dispatcher->>Cookies: set or unset CookieName.ID_TOKEN
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning Tools execution failed with the following error: Failed to run tools: 13 INTERNAL: Received RST_STREAM with code 2 (Internal server error) 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: |
…olves the client logout.vue passed client_id=web (the name) but the id_token aud is the web client UUID. The end-session service aud/client_id cross-check then failed, clearing hintVerified, so the session was never revoked and the browser never bounced back to /login — every client-web logout silently degraded to the confirm page, defeating the round-trip. Omitting client_id lets the service resolve the client from the hint sole aud.
Plan 042 items 8a + 8. Independent of the server-core PRs (#3198–#3200) — branches off master.
8a — the kit store retains the id_token
applyTokenGrantResponsekept only the access/refresh tokens, so no kit-based RP could pass anid_token_hintto the newend_session_endpoint(#3196) — every logout degraded to the click-gated confirm page.idTokenref +setIdTokensetter emittingStoreDispatcherEventName.ID_TOKEN_UPDATEDCookieName.ID_TOKEN(@authup/core-http-kit) + the install-time read/write handlers, mirroring the access/refresh token patterncleanup()applyTokenGrantResponseretains the existing id_token when a response carries none — a refresh grant returns no id_token, and the session is unchanged, so the hint must survive a token refresh8 — client-web round-trips through
/logoutapps/client-web/pages/logout.vuepreviously justnavigateTo('/login')after the interceptor's local cleanup — the shared authup-origin session survived. Now the page owns the sign-out:REQUIRED_LOGGED_OUT— that meta made the routing interceptor runstore.logout()before the page's setup, discarding the id_token the round-trip needsidToken/realmId, runs the local-onlystore.logout(), then hard-redirects tobuildEndSessionURL({ baseURL, idTokenHint, clientId: 'web', realmId, postLogoutRedirectUri: <origin>/login })/login; without it, the server's click-gated confirm page returns to/loginstore.logout()stays local-only — the round-trip is the chosen mechanism, not aDELETE /sessions/@me(established in plan 041: that collides with the #3191 interactive-login session reuse → self-DoS of fresh logins).Tests
New
packages/client-web-kit/test/unit/core/store/id-token.spec.ts: the grant response id_token is retained; cleared on logout; and a refresh-shaped response (no id_token) keeps the retained one. Full client-web-kit suite green (21), core-http-kit green (19), client-webnuxi typecheckclean.Summary by CodeRabbit
New Features
Bug Fixes
Documentation