如何获取/生成店面 API 的访问令牌

时间:2021-03-22 11:18:29

标签: shopify laravel-8 shopify-api

我正在使用 https://github.com/osiset/laravel-shopify 包来管理带有 laravel 8 的 Shopify API 并面临以下错误:

HTTP/1.1 403 禁止 { "errors": "应用程序必须可扩展才能创建店面访问令牌。" }

尝试以下操作:

$shop = Auth::user();
$orders = $shop->api()->rest('POST', '/admin/api/2021-01/storefront_access_tokens.json', ['storefront_access_token' => ['title' => 'mobile']]);
dd($orders);

1 个答案:

答案 0 :(得分:0)

我想回答我自己的问题,因为最终我找到了解决方案: 为此,您必须具备以下要求:

  1. 一个公开的 shopify 应用
  2. 启用销售渠道(您可以在应用->您的应用->应用设置中找到它)
  3. 具有以下值的 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_read_customer_customers

并且您需要注销(如果已经登录),然后使用 shopify 重新进行身份验证,然后您将能够使其工作。