So basially, I am trying to do a GET request test from the shopify api with my private app's credentials using the following format for related store's data such orders, customers, products, and analytic contents. The credentials will be hidden in the back end. For now, I am just testing the http request base on what the Shopify document gives me.
So my problem is that if I paste the link on the browser, it works. When I try to call it on the website, it give me the following error. I am testing this on localhost.
GET https://xxxxxxxxxx.myshopify.com/admin/orders.json 401 (Unauthorized)
No 'Access-Control-Allow-Origin' header is present on the requested resource.
If you can please let me know what I am doing incorrectly, that would be greatly appreciated.
Make sure you are using the shop domain (available in the API - https://help.shopify.com/api/reference/shop) to build your request, otherwise you WILL get CORS errors.
If you blindly use "<shop_name>.myshopify.com" your requests may work on a test store but they will fail if the store uses an actual domain name