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
Add HttpOnly session cookies for SLAS private client proxy
When MRT_DISABLE_HTTPONLY_SESSION_COOKIES is 'false', token responses from
SLAS are intercepted: access_token, refresh_token, and idp_access_token are
set as HttpOnly cookies and stripped from the response body. The client
receives access_token_expires_at for expiry checks without needing the JWT.
Server-side (pwa-kit-runtime):
- applyHttpOnlySessionCookies() intercepts token responses, sets HttpOnly
cookies with siteId suffix, and strips tokens from body
- applyProxyRequestAuthHeader() reads access token from HttpOnly cookie and
sets Authorization header for SCAPI proxy requests
- isScapiDomain() utility for identifying Commerce API domains
- Configurable tokenResponseEndpoints and slasEndpointsRequiringAccessToken
regexes for controlling which endpoints are processed
Client-side (commerce-sdk-react):
- useHttpOnlySessionCookies flag on Auth and CommerceApiProvider
- isAccessTokenExpired() uses access_token_expires_at when HttpOnly enabled
- handleTokenResponse() skips storing tokens in localStorage when HttpOnly
- Provider ensures fetch credentials allow cookies to be sent
Note: TAOB (Trusted Agent on Behalf) and refresh token flows with HttpOnly
cookies will be handled in follow-up work.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: packages/pwa-kit-runtime/CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,6 @@
1
1
## v3.17.0-dev
2
2
- Add Node 24 support. Migrate deprecated Node.js `url.parse()` and `url.format()` to the WHATWG `URL`[#3652](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/3652)
3
+
- Add HttpOnly session cookies for SLAS private client proxy: when `MRT_DISABLE_HTTPONLY_SESSION_COOKIES` is not `'true'`, token responses are intercepted and session tokens are set as HttpOnly cookies; token fields (access_token, idp_access_token, refresh_token) are stripped from the response body. The client continues to get expires_in and refresh_token_expires_in from the response body. This runs before `onSLASPrivateProxyRes`; custom callbacks receive the sanitized response and should read from response headers (e.g. Set-Cookie) rather than the body when using HttpOnly session cookies. An error is thrown if `siteId` is missing in commerce API parameters.
3
4
4
5
## v3.16.0 (Feb 12, 2026)
5
6
- Migrate AWS SDK from v2 to v3 [#3566](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/3566)
0 commit comments