当我尝试从Koa.js服务器向StoreFrontAccessToken api提交请求时,启用了销售渠道的应用程序正在收到此响应:
const returnStoreFrontToken = async (generalAccessToken, shopHost) => {
const storeFrontAccessTokenUrl = `https://${shopHost}/admin/api/2019-10/storefront_access_tokens.json`;
// get a list of current storefront access tokens
try {
const getResponse = await fetch(storeFrontAccessTokenUrl, {
method : "get"
, headers : {
"X-Shopify-Access-Token" : generalAccessToken
}
});
const data = await getResponse.json();
console.log(data, `=====data after get token(s)=====`);
}
} catch (e) {
console.log(e, `=====error=====`);
}
};
// usage in server.js
app.use(async ctx => {
const {shop, accessToken} = ctx.session;
console.log(`=====inside the middleware after verifyRequest()=====`);
const returnedToken = await returnStoreFrontToken(accessToken, shop); // 'App must have a channel record to create a storefront access token.
看起来像其他人一样也有此错误,但尚未发布解决方案:https://community.shopify.com/c/Shopify-APIs-SDKs/How-to-access-or-create-Storefront-token/m-p/569178/highlight/false#M37936
有人有这个问题的经验,知道如何解决吗?