WooCommerce - woocommerce_rest_cannot_view - 状态 401 [英] WooCommerce - woocommerce_rest_cannot_view - Status 401

查看:47
本文介绍了WooCommerce - woocommerce_rest_cannot_view - 状态 401的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经生成了一个消费者密钥和消费者秘密.该网站已安装 SSL.我还安装了 JSON 和 REST 服务所需的插件.这是网址的样子:

I have generated a consumer key and consumer secret. The website has SSL installed. I have also installed plugins required for JSON and REST services. This is how the url looks like:

https://<url>/wp-json/wc/v1/products

当我尝试通过使用 POSTMAN(Chrome 插件)使用基本身份验证获取(获取)产品详细信息时,我收到如下 JSON 响应:

When I am trying to get(GET) the product details using Basic Auth by using POSTMAN, a Chrome plugin, I get a JSON response like:

{
  "code": "woocommerce_rest_cannot_view",
  "message": "Sorry, you cannot list resources.",
  "data": {
    "status": 401
  }
}

我拥有与 Consumer 密钥对应的 READ 和 WRITE 权限.

I have both the READ and WRITE permissions corresponding to the Consumer key.

推荐答案

您收到的 401 错误是因为您使用的是基本身份验证,即使您的网站不安全(没有 https).

The 401 error you are getting is because you are using basic auth even though your website is not secure (does not have https).

postman 中的解决方案是使用 OAuth 1.0.只需添加消费者密钥和消费者秘密并发送请求即可.

The solution in postman is to use OAuth 1.0. Just add the consumer key and consumer secret and send the request.

这篇关于WooCommerce - woocommerce_rest_cannot_view - 状态 401的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆