i have a sales channel app with an access token with the following scopes.
https --check-status --ignore-stdin --timeout=180 GET "fancy-pants-store-1.myshopify.com/admin/oauth/access_scopes.json" Content-Type:"application/json; charset=utf-8" X-Shopify-Access-Token:"
the above works just fine but this fails.
```javascript
>>>>
https --check-status --timeout=180 POST "fancy-pants-store-1.myshopify.com/admin/api/2021-10/storefront_access_tokens.json" <<<'{"storefront_access_token": {"title": "Token"}}' Content-Type:"application/json; charset=utf-8" X-Shopify-Access-Token:"
I've tried multiple apps and multiple stores, logging out of all sessions, even logging out of shopify.com. i've used incognito windows etc. nothing seems to work.
can you provide step by step instructions to create a "sales channel app" and get a storefront access token. We have proprietary app that gets the same error and I've tried the sample app here as well to the same affect: [https://github.com/christopherdodd/shopify-koa-server](https://github.com/christopherdodd/shopify-koa-server)
I see a number of other posts about the same error, and same suggestions keep getting repeated, that don't work. very frustrating.
If someone else is having trouble with this. The below snippet worked for me. Seems setting the accessMode to offline is required, even though that’s supposed to be the default value for that field and it isn’t documented anywhere in the shopify docs. cheers.
scopes: [
"write_products",
"write_customers",
"write_draft_orders",
"unauthenticated_write_checkouts",
"unauthenticated_read_product_listings",
"unauthenticated_read_product_tags"
],
accessMode: "offline",
Exactly can you tell where to added the access mode Flag. I am also stuck at this same issue for multiple days.
Here’s the full snippet. You specify the scopes, access mode and other params when you create the Shopify auth request.
createShopifyAuth({
apiKey: SHOPIFY_API_KEY,
secret: SHOPIFY_API_SECRET_KEY,
scopes: [
"read_orders",
"read_products",
"read_customers",
"write_draft_orders",
"unauthenticated_write_checkouts",
"unauthenticated_read_product_listings",
"unauthenticated_read_product_tags"
],
accessMode: "offline",
afterAuth(ctx) {
const { shop, accessToken } = ctx.session;
console.log(`> session ${JSON.stringify(ctx.session)}`)
console.log(`> shop origin ${shop}`);
console.log(`> access token ${accessToken}`);
ctx.cookies.set("accessToken", accessToken, { httpOnly: false });
ctx.cookies.set("shopOrigin", shop, { httpOnly: false });
ctx.redirect("/");
}
})
1 Like
@wakkoyakkodot I hope this helps a lot of beginners like me. Thanks a ton. _/_