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)
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.
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? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
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.
User | Count |
---|---|
12 | |
12 | |
10 | |
7 | |
6 |