manual smoke surfaced the bug: the callback wrote the session and
set the portal_session cookie correctly, but the spa's next /me call
came back 401 with no cookie header at all.
root cause: angular's HttpClient via withFetch() inherits fetch's
default `credentials: 'same-origin'`. localhost:4200 → localhost:3000
is cross-origin (different ports), so the session cookie is dropped
on the way out — the bff never sees it. samesite=lax was a red
herring: localhost:4200 and localhost:3000 share the registrable
domain, so the cookie is still same-site; what was missing was
opting the fetch into credentials.
fix is per-call: only /me needs cookies today. login/logout are
full-page navigations through window.location, which the browser
hydrates with cookies regardless. a global HttpInterceptor will land
when other authenticated bff endpoints exist — premature for one
consumer.
bff side was already wired: enableCors({ credentials: true }) in
main.ts. nothing to change there.
a spec pins withCredentials=true on the /me request so a future
refactor can't silently drop the flag and reintroduce the bug.