Receiving 401 "Invalid API key" error while trying to create a storefront token

Receiving 401 "Invalid API key" error while trying to create a storefront token

Whis
Tourist
6 0 2

My main goal is to create a checkout. I tried to do that, but was told I need to create a storefront token. I successfully called the endpoint to create a storefront token, but I realized in order to create a checkout I need a public app. So I created a public app but now am not able to call the Create Storefront Token endpoint. It works fine with the private app's X-Shopify-Access-Token header but breaks when I try it on the public app. Here is what I'm doing in Postman:

POST

https://{{API Key}}:{{Password}}@{{store}}.myshopify.com/admin/api/2021-07/storefront_access_tokens.json

Headers:

X-Shopify-Access-Token{{ Public app's API secret key}}

 

Body (raw/JSON):

{
  "storefront_access_token": {
    "title": "Test"
  }
}

 

and this is the response I get:

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

 

Please someone help me! This documentation doesn't seem to line up with what actually happens in the API.

Reply 1 (1)

Luke_K
Shopify Staff
402 66 102

Hey @Whis 

Just messaging to see if you're still blocked by this?  I checked your app in the backend and noted that your public app hasn't been turned into a sales channel. The process for private apps is slightly different to the process for public apps, but public apps creating checkouts on the REST API(checkouts.json) or the Storefront API(docs) must be turned into a sales channel, which can be done in your Shopify partner dashboard. 

There's some documentation for doing this on the Storefront API here and a general guide for both REST/Storefront API here. Hope that helps!

 

| Shopify |
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!