【问题标题】:How to get/generate access token of storefront API如何获取/生成店面 API 的访问令牌
【发布时间】:2021-06-19 00:50:52
【问题描述】:
我正在使用 https://github.com/osiset/laravel-shopify 包通过 laravel 8 管理 Shopify API 并面临以下错误:
HTTP/1.1 403 禁止
{
“错误”:“应用程序必须可扩展才能创建店面访问令牌。”
}
尝试以下方法:
$shop = Auth::user();
$orders = $shop->api()->rest('POST', '/admin/api/2021-01/storefront_access_tokens.json', ['storefront_access_token' => ['title' => 'mobile']]);
dd($orders);
【问题讨论】:
标签:
shopify
laravel-8
shopify-api
【解决方案1】:
我想回答我自己的问题,因为最终我找到了解决方案:
要实现这一点,您必须满足以下要求:
- 一款公开的 shopify 应用
- 已启用销售渠道(您可以在应用程序->您的应用程序->应用程序设置中找到它)
- 具有以下值的 API 范围:
read_products、write_products、unauthenticated_read_content、unauthenticated_read_customer_tags、unauthenticated_read_product_tags、unauthenticated_read_product_listings、unauthenticated_write_checkouts、unauthenticated_read_checkouts、unauthenticated_write_customers、unauthenticated_read_customers
您需要注销(如果已登录),然后使用 shopify 重新进行身份验证,然后您就可以使用了。