Can I use 3rd party cookie in shopify store - App development

Highlighted
Shopify Partner
5 0 1

Hi, I'm on app development which is for shopify app stores.

(Node.js, Express, Javascript)

 

My app installs scripttag into merchants's store and create cookie with store's information.

When send request from scripttag to my app server, I get CORS Problem in browser console (image below)

Screen Shot 2020-03-21 at 5.54.14 PM.png

 

When I use below option when send request, error message disappears

withCredentials: false

And I lost cookie data either.

also can't really use the way to allowing origins because I'll provide the app to one or more stores

 

Is there way to get cookie data with "credentials: true" and no error messages on console

Thanks.

 

0 Likes
Highlighted
Shopify Staff
Shopify Staff
465 59 91

Hey @sunbae,

 

Can you try sending your request and omit the withCredentials directive? If that doesn't work, can you clarify which cookie you are trying to access?

JB | Developer Support @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 

0 Likes
Highlighted
Shopify Partner
5 0 1

Hi JB.

 

when I try to omit the directive(withCredentials:false) it don't send the request with cookie value.

according to this link https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS

I have to set allow-origin in my app server and it worked. but I don't really think I can set all the origins of stores which are using my app

 

The cookie I'm trying to access is to track which pages customers have visited.

for example, customer went to the product page through certain collection page. our app tracks which collection page customer pass through

we save the page information(url, collection title etc ..) in cookie then extract it in product page to send request to the app.

 

If you have any idea please let me know, I'm still working on it to solve cookie problem

Thanks.

 

 

0 Likes