pwa-kit
pwa-kit copied to clipboard
[BUG] Hybrid session not restored after logging in via PWA once dwsid exists
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
- start out on pwa, add products to guest cart
- cart page redirects to SFRA cart page, session is successfully restored from PWA refresh token
- on SFRA login page, click "login" -> returns to PWA for login
- login via PWA
- return to SFRA cart page. notice that the previous guest
dwsid
is still set andonSession
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