You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Conservative cookie-migration subset (Option A-light). The v3 gateway
sets an HttpOnly __Host-Http-r402_session cookie on successful auth
but Kychon was only persisting the JSON access_token in localStorage
and sending it as Authorization: Bearer. Two consequences:
1. The cookie was being set but never traveled on subsequent
requests (browsers don't send credentials cross-origin without
`credentials: 'include'` opt-in). Defense-in-depth missing.
2. signOut() only removed localStorage — the server-side session
stayed valid until the access_token's natural expiry.
Now every auth.v1/* fetch and the @kychon/sdk capability call carry
`credentials: 'include'`, so the cookie travels both ways. signOut()
becomes async and POSTs /auth/v1/sign-out, killing the server-side
session before clearing the local cache. SignInBarIsland's local copy
of signOut() (which previously only cleared localStorage) now routes
through the shared @/lib/auth.signOut() so the UI sign-out button
participates in the full flow.
Bearer header kept alongside the cookie — gateway accepts either, and
during the BC window sending both is the safest combination (cookie
gives platform-side enforcement; Bearer keeps the existing JS-readable
session payload working for getRole()/isAdmin()/getSessionEmail()).
Tasks #5–#7's bigger refactor (drop localStorage entirely, convert
getRole() to async, swap to auth.whoami capability for session state)
remain deferred — they touch 8 components across the React island
graph and warrant a focused change after this cookie path is verified
on the demos.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 commit comments