CORS issues associating customer with checkout

Highlighted
Tourist
10 3 2

 

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).

 

 

0 Likes
Highlighted
Shopify Staff
Shopify Staff
922 121 129

Hey @samullman 

 

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

0 Likes