bigcommerce / storefront-data-hooks

Hooks for React Storefront UI Components
MIT License
166 stars 36 forks source link

Update the login handler. #66

Closed jorgemasta closed 3 years ago

jorgemasta commented 3 years ago

@jorgemasta we might need to update the login handler.

The checkout session fails when...

  1. User logs in
  2. Goes to checkout
  3. Back to site and logs out
  4. Logs back in
  5. Go to checkout
  6. User is logged out

I've got a fix here: https://gist.github.com/magicspon/93f42be4395702db8ec006e9cb6236b2

SHOP_SESSION_TOKEN and Shopper-perf are handled in the same way as SHOP_TOKEN

Originally posted by @magicspon in https://github.com/bigcommerce/storefront-data-hooks/issues/63#issuecomment-843530145

jorgemasta commented 3 years ago

hey @magicspon , hasn't this been solved in 1.3.1? or is it a different problem?

magicspon commented 3 years ago

Yup, it's a different issue. It only happens on subsequent visits to the checkout, after the user has logged out of the headless site. Moving SHOP_SESSION_TOKEN and Shopper-perf so that they are available on both domains solves the issue

magicspon commented 3 years ago

https://user-images.githubusercontent.com/3268717/118807125-cf2bd800-b89f-11eb-81c1-c4455e2ef3f1.mp4

magicspon commented 3 years ago

With the fix (in the gist)

https://user-images.githubusercontent.com/3268717/118807290-ff737680-b89f-11eb-8c63-0769728e90d2.mp4

jorgemasta commented 3 years ago

Thanks very much for all the information! 🙌 We will try to fix it asap.

jorgemasta commented 3 years ago

Solved in #72