Shopify npx shopify hydrogen link Access Denied

I am trying to create a Shopify website using shopify hydrogen, in the documentation it says to do npx shopify hydrogen. When i do this i get this error: The Admin GraphQL API responded unsuccessfully with errors: [ { "message": "Access denied for hydrogenStorefronts field. Required access: Request must be initiated from the Shopify CLI and user must have full access to apps or access to the Hydrogen channel.", "locations": [ { "line": 3, "column": 5 } ], "path": [ "hydrogenStorefronts" ], "extensions": { "code": "ACCESS_DENIED", "documentation": "https://shopify.dev/api/usage/access-scopes", "requiredAccess": "Request must be initiated from the Shopify CLI and user must have full access to apps or access to the Hydrogen channel." } } ] Request ID: 90efe6d3-afcc-4dc3-8766-d612ceeecf62-1713263066 I have also watched some tutorials no how to set it up, and they say to go to your .env file and edit/add: PUBLIC_STORE_DOMAIN, PRIVATE_STOREFRONT_API_TOKEN, PUBLIC_STOREFRONT_API_TOKEN However my env file only has SESSION_SECRET="foobar" PUBLIC_STORE_DOMAIN="food-yes.myshopify.com" it doesnt have a PRIVATE_STOREFRONT_API_TOKEN, PUBLIC_STOREFRONT_API_TOKEN variable declared. Any advice would be helpful.

Comment (1)

Jese Leos

August 19, 2024

Verified user

I've had the same problem. My solution was to use the storefront API (Headless channel). The getting started page for Hydrogen does say that the Hydrogen Channel on your store is a requirement, however this can't be used on a development store (which was true in my case). Download the Headless channel, here are the getting started docs, follow up to step 2 for the storefront API. This will give you these env variables: PUBLIC_STOREFRONT_API_TOKEN PRIVATE_STOREFRONT_API_TOKEN Instead of step 3 in the docs, go update your .env file. Change the existing PUBLIC_STORE_DOMAIN variable with your store url i.e. {store_name}.myshopify.com. You can go through the same process to add the customer account API, haven't done that myself yet. Use npm run dev and the store should be using your product information.

You’ll be in good company