GraphQL errors: [API] Invalid API key or access token (unrecognized login or wrong password)

Topic summary

Issue: A Shopify GraphQL request succeeds via cURL using the Storefront API token but fails in a Node.js implementation with “GraphQL errors: [API] Invalid API key or access token (unrecognized login or wrong password).”

Details:

  • cURL call to https://brmutual.myshopify.com/api/2024-01/graphql.json with header X-Shopify-Storefront-Access-Token and a products(first: 5) query returns data.
  • The equivalent Node.js request returns an auth error, suggesting a possible mismatch in headers, token, or endpoint usage between the two methods.

Next steps / latest update:

  • Another participant requested the Node.js script to compare configuration (e.g., headers, token type, API version/endpoint) and diagnose the authentication failure.

Status: Unresolved; awaiting the Node.js code snippet to proceed with troubleshooting.

Summarized with AI on January 6. AI used: gpt-5.

When I run a curl request, I can access my product and see data showing up
curl -X POST
https://brmutual.myshopify.com/api/2024-01/graphql.json
-H ‘Content-Type: application/json’
-H ‘X-Shopify-Storefront-Access-Token: 4746e2379’
-d ‘{“query”: “query { products(first: 5) { edges { node { id title } } } }”}’
but when I tried to access it with node.js is giving me this error GraphQL errors: [API] Invalid API key or access token (unrecognized login or wrong password)

Can you share your node.js script?