通过邮递员访问WooCommerce API时出现401错误

时间:2018-12-07 22:40:08

标签: wordpress woocommerce woocommerce-rest-api

好的,我知道这是非常非常常见的问题。因此,我只想陈述一下我为解决此问题所做的工作。我已经安装了herehttps://github.com/WP-API/Basic-Auth)的插件,已禁用Postman中的SSL检查,我暂时关闭了服务器上的应用程序防火墙,并且通过使“通过网络浏览器请求,其地址类似于https://example.com/wp-json/wc/v2/products?consumer _key=ck_xxxxxxxxxxxxxxxxxxxxxxxxxxxx&consumer_secret=cs_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

目前,我收到以下响应: {"code":"woocommerce_rest_cannot_view","message":"Sorry, you cannot list resources.","data":{"status":401}}

最后,我认为Postman会通过http请求发布以下代码:

GET /wp-json/wc/v2/products HTTP/1.1
Host: example.com
Authorization: Basic xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
cache-control: no-cache
Postman-Token: xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

0 个答案:

没有答案