Shopify / mobile-buy-sdk-ios

Shopify’s Mobile Buy SDK makes it simple to sell physical products inside your mobile app. With a few lines of code, you can connect your app with the Shopify platform and let your users buy your products using Apple Pay or their credit card.
MIT License
453 stars 198 forks source link

New X-Shopify-Customer-Access-Token doesn't override old one #976

Open caisd1998 opened 5 years ago

caisd1998 commented 5 years ago

Mobile-Buy-SDK (3.3.2)

I use checkout weburl, user associate, WKWebview and http header X-Shopify-Customer-Access-Token, it's working great, until I find that if I create another user access token and use it to create a new checkout (use a new WKWebview and new X-Shopify-Customer-Access-Token header), the web checkout still shows old user's information (login status, shopping address list etc. ) Looks like it's because of cookie and the new X-Shopify-Customer-Access-Token doesn't override old one if cookie exists. My dirty fix is to delete all cookies (maybe just what related to myshopify.com domain) before I start a WKWebview for web checkout.

This relates to an old issue: https://github.com/Shopify/mobile-buy-sdk-ios/issues/841

jmignac commented 5 years ago

Hey, @caisd1998,

Thanks for flagging this issue. We have the team responsible tracking this issue, and we'll post an update here once we have fixed it!

BevTheDev commented 5 years ago

I am seeing this issue as well on 3.3.2, except clearing cookies and local cache doesn't correct the issue if the user has closed/reopened the app after checkout. (I'm not sure why that makes a difference). However, launching the same checkout url a second time in a webview corrects the problem.

caisd1998 commented 5 years ago

@BevTheDev I change to use UIWebview instead of WKWebview, the reason is, the way I use to clear cookie in WKWebview doesn't seem to be working all the time.

anant-creoit commented 4 years ago

Did you found the solution?

darkguy2008 commented 3 years ago

This issue is still open, any progress so far?

martijnarts commented 1 year ago

@jmignac looks like this is still happening in 2022. Any planned fix or workaround?

martijnarts commented 1 year ago

I worked around this by loading the logout page before opening the order.