Getting Error 403 Forbidden when requesting API with valid access token

Hi, I am trying to use the order API to get the orders. I followed these steps: https://www.shopify.com/partners/blog/17056443-how-to-generate-a-shopify-api-token

Shopify Install URI

https://transleadgroup.myshopify.com/admin/oauth/authorize?client_id=3390eb562f7931e34f6c82e5b5e84f41&scope=read_orders,write_orders&redirect_uri=https%3A%2F%2Fwww.example.com%2Fshopify_store_access_token

Shopify Get Access Token Response

{“access_token”:“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”,“scope”:“write_orders”}

Shopify Response when calling

/admin/api/2020-10/orders.json

I used the shopify_call function from the guide. Below is the response of the order API.

{“headers”:{“status”:“HTTP/1.1 403 Forbidden\r”,“Server”:“cloudflare”,“Date”:“Fri, 16 Oct 2020 01”,“Content-Type”:“text/html”,“Content-Length”:“151”,“Connection”:“keep-alive”,“CF-RAY”:“5e2e09e8e85b0564-LAX”},“response”:“\r\n403 Forbidden</title></head>\r\n\r\n

403 Forbidden</h1></center>\r\n
cloudflare</center>\r\n</body>\r\n</html>\r\n”}

I did I do wrong. Can anyone help? Thanks.

Are you trying to GET or are you trying to POST to /admin/api/2020-10/orders.json?

When you are getting a Cloudflare 403 error response I think it might have something to do with the “middleman” service seeing an issue with your originating IP subnet you’re coming in from. Like a blacklist scenario or something. Especially if this isn’t a transient type of error response you’re getting.

I am using Get request. This is how I use the shopify_call function.

$result = $this->shopify_call($access_token, $user->shopify_store_name, "/admin/api/2020-10/orders.json", [], 'GET');

Add Host header with the same domain name you are requesting in the URL might resolve it.

However I think Shopify should resolve this w/ Cloudflare