FROM CACHE - en_header

CORS issues associating customer with checkout

samullman
Tourist
10 3 4

 

let req = new XMLHttpRequest()
req.open( "GET", context.state.checkout.webUrl  )
req.setRequestHeader("X-Shopify-Customer-Access-Token", window.localStorage.shopifyAccessToken);
req.setRequestHeader("Access-Control-Allow-Origin", "*");
req.send();

 

redirecting to the Buy SDK webUrl with an associated customer and the request is being blocked by CORS ... 

 

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://xxxxx.myshopify.com/.....   (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).

 

 

Reply 1 (1)
SBD_
Shopify Staff
Shopify Staff
1098 146 224

Hey @samullman 

 

Have you tried redirecting the customer to context.state.checkout.webUrl, instead of using AJAX?

Scott | Developer Support @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog