Struggling to fetch products.json from API, can anyone help?

Hi, is there anybody who can helps me with the fetch request to shopify API? I would like to get all products and use them for product select in form. I dont really know whats wrong with it.

I read docs and i think it should work this way, but i am getting console errors and cant get response.

I had created private app because access and tokens, but still cant find the solution.

Do you mean add this code to headers: {

‘Content-Type’: ‘application/json’,
‘X-Shopify-Access-Token’:“fb70610e4eb8cbd8c14557560e8a190a-1681990272”, ‘Access-Control-Allow-Origin’: ‘*’,

}

this way? Thats what i found on the internet

1 Like

I have it this way now, but still doesnt work

Idk man, but i am doing it with javascript now and still doesnt work..

I use it that way exactly, but where is the problem? In headers i have an extra access- token which i should use i guess?

Am i doing anything wrong besides writing differently?