admin管理员组

文章数量:1327665

Closed. This question is off-topic. It is not currently accepting answers.

Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.

Closed 4 years ago.

Improve this question

;consumer_secret=abc is working on when entered into the browser but fail with CURL with error:

{"code":"woocommerce_rest_cannot_view","message":"Sorry, you cannot list resources.","data":{"status":401}}
Closed. This question is off-topic. It is not currently accepting answers.

Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.

Closed 4 years ago.

Improve this question

https://www.example/wp-json/wc/v3/orders?consumer_key=123&consumer_secret=abc is working on when entered into the browser but fail with CURL with error:

{"code":"woocommerce_rest_cannot_view","message":"Sorry, you cannot list resources.","data":{"status":401}}
Share Improve this question edited Jul 29, 2020 at 18:39 Tom J Nowell 61k7 gold badges79 silver badges148 bronze badges asked Apr 4, 2020 at 21:59 Akan UdosenAkan Udosen 113 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

I took a lot of time – the whole night – trying to fix this “401: Sorry, you cannot list resources.” The solutions shared by many online are great although they did not work as stated for me. In my case, running my own VPS server, what worked for me was going to WHM then under Service Configuration clicking Apache Configuration. In the “Include Editor:” in the “Pre Main Include”, I selected "All Versions" and pasted this from this link https://robotninja/blog/fix-common-woocommerce-rest-api-issues/

SetEnvIf Authorization “(.*)” HTTP_AUTHORIZATION=$1

On update it will ask to restart Apache. Restart and test your API – it should work. If you receive a 500 Internal Error, simply deactivate and reactivate woo-commerce plugin in the plugins section of WordPress.

Hope this helps someone and saves them hours of frustrations.

Edit... had to refer to this after i reset my configurations. In this line: SetEnvIf Authorization “(.*)” HTTP_AUTHORIZATION=$1 replace the double quotes and use the standard quotes because the above are pasted from Microsoft Word and are not the right kind of quote. Use this instead.

SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1

Hope this helps anyone who may stumble upon this issue

本文标签: What will make Woocommerce REST API to issue 401