Yet another "Invalid API key or access token (unrecognized login or wrong password)" thread

Topic summary

Issue: Users encounter \

Summarized with AI on November 12. AI used: claude-sonnet-4-5-20250929.

Like some before I receive this error when trying to access the api (get orders). Since the api access changed the older topics are outdated for my case. I try to access “orders.json” via native PHP with curl functions.

I try to access it with the storefront-api-token I received after installing my custom app.

My code looks like this

$app_token = 'xxx'; // I get this when installing my app, attached a screen
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type:application/json','X-Shopify-Access-Token: '.$app_token]);
curl_setopt($ch, CURLOPT_URL, "https://xxx.myshopify.com/admin/api/2023-10/orders.json?status=any"); // xxx is my store id
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$result = curl_exec($ch)

HI Janrosi,

Can you make calls to any Shopify API endpoint, or is it just orders which you’re having this issue with?

I tried it with products/count (2023-10/products/count.json) and have the same result “Invalid API key or access token (unrecognized login or wrong password)”.

Is it maybe because I don’t have a development store? I am using a regular shopify and created a custom app for that.

I solved it with some extern help. The shopify error message wasn’t really accurate. I gave storefront-api permissions but forgot about the shopify-admin permissions. Once I set them and used the admin-api-token instead of the storefont-api-token, it works.

1 Like

Did you create a custom app via the stores’ admin - or is this a custom app created via the CLI? It’s likely there is some auth issue here where the storefront API Token isn’t registered correctly.

Glad you figured it out - I’ll pass on the feedback too, regarding the error message

Hi @janrosi . I am having the same issue. Could you please explain with more detail this: I gave storefront-api permissions but forgot about the shopify-admin permissions. Once I set them and used the admin-api-token instead of the storefont-api-token, it works.

I have been working with shopify apis for some time but I am no expert. Thanks!

I am using this to auth and it works ok:

https://{store}.myshopify.com/admin/oauth/access_token

{“client_id”:“xxx”,“client_secret”:“xxx”,“code”:“xxx”}

But then this one doesnt work:

https://{store}.myshopify.com/admin/api/2024-01/locations.json

X-Shopify-Access-Token: xxxx

{“errors”: “[API] Invalid API key or access token (unrecognized login or wrong password)”}

It has been working for 2 or 3 years now, but with a new custom app is not working…