Issue with using graphql and php library

Issue with using graphql and php library

jordancarr1514
Shopify Partner
1 0 0

I'm trying to create a simple app that reads our stores products, contacts an external API to get stock levels then update our stores products with the new stock levels how ever encountering alot of issues..

 

The examples for the graphQL library for php seems to be a bit strange, says i need to authenticate my app using auth0 which will give me a session token and allow me to query then my shopify store using graphQL however that seems strange to me?

 

This app will be completely headless.. will be run on a cron job so why would i need to authenticate? Isn't that what my stores api key and access token is for?

 

Anyway i tried to then make a request to my store https://XXXXXX/admin/api/2025-01/graphql.json

with the X-Shopify-Access-Token in the headers and i get a curl error " cURL error 6: Could not resolve host: login"

 

if i try visit that url in my browser a login box prompts for a username and password?

 

Any help would be appreciated, thanks.

Reply 1 (1)

laketuna
Shopify Partner
6 0 5

Shopify's PHP SDK is unfortunately geared toward regular Oauth (browser) users. You can use Context::initialize() to get things started for headless usage.