【问题标题】:The consumer isn't authorized to access - access token React and Magento 2消费者无权访问 - 访问令牌 React 和 Magento 2
【发布时间】:2022-01-25 14:02:54
【问题描述】:

我正在尝试从 Magento 2 获取数据,但我在控制台上收到此错误

The consumer isn't authorized to access %resources.", parameters: {…}, trace: '#0 /var/www/html/magento/vendor/magento/module-web…Magento\\Framework\\App\\Bootstrap->run()\n#16 {main}'}

我想我需要添加一个访问令牌来获取数据,但我不知道如何将令牌添加到我的代码中

fetch("https:.....com/rest/V1/categories")
.then((response) => response.json())
.then((json) => console.log(json));

【问题讨论】:

    标签: reactjs magento magento2


    【解决方案1】:

    您需要将不记名令牌添加到您的 API http://myhost.com/rest/V1/categories?Authorization=Bearerhy23vc01x9s1jd2t8gho47g58trllc0b

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-02-07
      • 2014-01-10
      • 2016-07-13
      • 2017-06-03
      • 1970-01-01
      • 2014-09-12
      • 1970-01-01
      • 2011-12-31
      相关资源
      最近更新 更多