pwa-kit icon indicating copy to clipboard operation
pwa-kit copied to clipboard

[BUG] Hybrid session not restored after logging in via PWA once dwsid exists

Open sandragolden opened this issue 2 years ago • 0 comments

Summary

Removing the session bridge in PR #684 breaks phased rollout approach when switching between PWA and SFRA as a guest and registered customer.

Steps To Reproduce

  1. start out on pwa, add products to guest cart
  2. cart page redirects to SFRA cart page, session is successfully restored from PWA refresh token
  3. on SFRA login page, click "login" -> returns to PWA for login
  4. login via PWA
  5. return to SFRA cart page. notice that the previous guest dwsid is still set and onSession is never triggered on SFRA, resulting in a cleared guest cart. Customer is not logged in via SFRA.

Expected result

Returning to SFRA after logging in via PWA should maintain session state and cart

Additional information

Adding back the code removed in PR #684 fixes this issue.

Current State: Notice that returning to SFRA the second time never calls onSession so the dwsid is never set from the logged in refresh token. The old dwsid from the initial session is used, resulting in an empty cart. There's no way to login via SFRA.

https://user-images.githubusercontent.com/375787/192851283-ddea313f-ecfc-4451-b984-f3f862a460b1.mov

Updated State

https://user-images.githubusercontent.com/375787/192851325-e499d233-b54b-44e5-8e73-11e5d274d4c9.mov

sandragolden avatar Sep 28 '22 17:09 sandragolden