We have several shopify stores we access each with our API, the same API fails for one store with error 401 unauthorized. I have recreated the issue with a simple CURL api in postman. I got one that works with store A and the changed the store subdomain and token and it fails. I ensured a dozen times that the u/p that compromise the token are accurate. The store admin screens have a bit of a different look and I understand that the apps are now custom instead of private (with seamless transition).
Is there anything in the store configuration that I need to double check? Is there something else to do to drill down on this issue?
Here is the curl, with the shop and the token altered.
A 401 error response from our API generally refers to incorrect or missing authentication being sent with a request. I found your other post mentioning the change from using private to custom apps and just wanted to touch base here.
I was able to do some testing and my first suggestion for troubleshooting would be rotating credentials for the app, which may require contacting the merchant if you donāt have a collaborator account with the Develop Apps permission.
After following those resources if the error proceeds and you feel there is a bug, please provide an x-request-id value returned in the response header along with the error - you can do this by adding either the-v or -i argument to a cURL request, or found in many API clientās response header tab.
At this time, our team is unable to authenticate to locate accounts related details via these community forums, however the details mentioned above help us locate logs, share insights, or provide suggestions moving forward.
@ytrend I found out how to do it with GraphiQL. You are this close already, friend.
I really just needed to see that. Itās so much easier to understand, for me at least, when another human explains it compared to reading the docs.
Hereās my code:
function myFunction() {
var url = "https://
This gets the first image url from the first product. You can use the GraphiQL tool to spin your own data sets very easily. I need to eat, sleep and dream GraphQL for a couple of weeks, lol.
For anyone who has this issue I have the fix (I am using a private app and had previously set this up without issue on other shops until now).
It looks like they have updated the authorization to only with the token supplied from within the private app and not the once generated from the Buffer of the API Key & Secret (password).
To get this key - you need to go to your private app and select āAPI Credentialsā and then generate an āAdmin API access tokenā. If you use this it should work (it did for me after about an hour of frustration).
Iām having the same issue here. I had a look at your solution but I have already generated the API Key. I can get products through on my store but Whenever there is a 401 error to /api/2022-07/graphql 40 I dont know what I havent set up correctly??
I encountered this today when building a new app using shopify-api-node.
Previously when you created a new instance of Shopify, you needed to pass in apiKey and password. It now seems like you only need to hand in accessToken. Example below of what worked for me today.
const shopify = new Shopify({
shopName: process.env.SHOPIFY_NAME,
accessToken: process.env.SHOPIFY_ACCESS_TOKEN,
});
Hi so this means that, apiKey and password is not working anymore thus you have to only use the accessToken? I also tried to login from the web using my accesskey and secret but I am getting 401 everytime
Hey buddy, I encountered the same issue today with all Shopify API calls in my app. However, I managed to fix it. I used ānpm run dev ā --resetā and instructed it to choose an existing app. When it came to selecting the app name, I noticed I had many names (due to renaming my app). Itās crucial to select the name āYour app name (shopify.app.toml)ā. I believe this might be the reason behind the issue. Hope this helps you!
The response looks like this:
{
āresponseCodeā: 401,
āerrorResponseā: ā{"errors":"[API] Invalid API key or access token (unrecognized login or wrong password)"}ā
}