@acromedia/gesso-shopware-middleware
8.2.0
Minor Changes
-
2ccc25a: Implement Shopware authentication (
useAuth).@acromedia/gesso-shopwarereplaces theuseAuthstub with the full auth surface on Shopware's public Store API account routes:login(POST /account/login, thenPOST /account/customer),logout,password.passwordResetEmail(recovery-password), andpassword.passwordReset(recovery-password-confirm). Login returns the rotatedsw-context-tokenon the customer asoptions.accessToken— the same slot BigCommerce uses for its customer access token, and the fieldGessoAuthOptionscopies onto the next-auth JWT — so a login performed server-side insideauthorizecarries its Store API session forward. Logout drops thegesso-sw-contextcookie so the next visit opens a clean guest session. Adds the optionalshopwareRecoveryStorefrontUrlandcookieNameconfig keys.@acromedia/gesso-shopware-middlewareadds theexistsaction — an Admin-API account-exists probe (GET /api/middleware/shopware/exists?email=) that answers with the bare customer id or a 404, backinguseAuth.existsand next-auth'sGessoAdapter.getUserByEmail. It returns only the id, so an email-keyed probe cannot expose a customer's name, addresses, or order history.getContextTokennow also reads the token from the JWT'saccessTokenkey, whereGessoAuthOptionsstores it by default.
8.1.0
Minor Changes
-
0d108e1: GESSO-2429-feat: add Shopware 6 API-middleware plugin
New
@acromedia/gesso-shopware-middlewarepackage implementing theProvidercontract from@acromedia/gesso-api-middleware. It is the server-side companion to the browser-side@acromedia/gesso-shopwarecommerce plugin — anything that needs a secret or a privileged lookup lives here, not in the bundle that ships to the browser.- Routes
/api/middleware/shopware/{action}to Shopware's REST Store API (/store-api) and, for elevated operations, its Admin API (/api). Storefront, customer-scoped actions (address,customer,orders) authenticate with the sales-channelsw-access-keyplus the logged-in customer'ssw-context-token; admin-scoped actions (customers,payments) authenticate the integration itself via the Admin API OAuth2client_credentialsgrant. - Reads the customer's
sw-context-tokenfrom the next-auth session JWT (a forwardedsw-context-tokenrequest header is honoured as a fallback), echoes Shopware's rotated token back in answ-context-tokenresponse header so the client can persist it. - Talks to both APIs through the official
@shopware/api-clientSDK (pinned), wrapped in a thinStoreApiClient/AdminApiClientinsrc/rest.ts— mirroring how@acromedia/gesso-shopwarewraps the same SDK. The admin client memoizes one OAuth2 client per host + integration id so the bearer is cached and auto-refreshed across requests, staying within Shopware SaaS's token rate limit. - Ships as a dual ESM + CJS package built with
tsup; unit-tested with Vitest (Store API and Admin API mocked with MSW).
- Routes