What's your biggest current challenge? Have your say in Community Polls along the right column.
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

CORS issue when connecting to Admin API

CORS issue when connecting to Admin API

seanrs97
Shopify Partner
1 0 1

Hi 

 

I'm getting a CORS error whenever I try to connect to a private app that I've created in the backend for reading & writing content. I really only need the app to pull in data for data such as blog posts, products etc.

 

The request I'm using can be found below.

 

 

       const config = {
          headers: {
            'Access-Control-Allow-Origin': "*",
            'Access-Control-Allow-Methods': "GET",
            'Access-Control-Allow-Headers': "*",
            'X-Shopify-Access-Token': "{{ACCESS-TOKEN}}",
            'Content-Type': 'application/json',
          }
        };
        const url = "{{shop.url}}/admin/api/2022-04/blogs/{{blog.id}}/articles.json";
        await axios.get(url, config)

 

 

 After this, I'm just using the response to log the data. Unfortunately it doesn't get this far, instead it gets caught in the catch that I'm using, which just throws an Axios error. 

 

Any help on this is really appreciated.

Replies 0 (0)