vuestorefront / shopware-pwa

Shopware PWA for eCommerce. Headless storefront solution for Shopware 6, which communicates through the SalesChannel-API. Always Open Source, MIT license. Made with :blue_heart: by shopware AG & Vue Storefront.
https://frontends.shopware.com
MIT License
345 stars 103 forks source link

[Bug] no context token returned in login response for SW 6.6 #2013

Closed augsteyer closed 5 months ago

augsteyer commented 5 months ago

What happened?

Description

Support context token being returned in the header instead of the response body starting with Shopware 6.5 (optional), and 6.6 (required).

Acceptance criteria

Parse header sw-context-token & return it in login call. The logout also has this header, however, the client logout implementation currently does not return anything, so there is no requirement to change the signature of the method.

Steps To Reproduce

  1. Any Shopware 6.6+ version is needed
  2. Make a login call via client
  3. See that no context token is returned anymore

Is there an existing issue for this?

Version

Latest stable (generated by CLI)

Which element is affected?

shopware-6-client

Environment

- OS: macOS
- Node: 21.2
- Shopware API: 6.6.0.0
- Shopware PWA version: 1.6.1

Relevant log output

N/A
patzick commented 5 months ago

@augsteyer hey, thanks for reaching out. The context token is already extracted from the headers by extractContextToken helper. Code: https://github.com/search?q=repo%3Avuestorefront%2Fshopware-pwa+extractContextToken&type=code

so if you're using onConfigChange callback you should receive the correct context. Let me know if that helps!

augsteyer commented 5 months ago

Yup, that's my bad. You are totally right.