skip to Main Content

Even after setting up the REST API WooCommerce, you still get the following when performing an authenticated request:

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

2

Answers


  1. Chosen as BEST ANSWER

    The Authorization header is not being passed to PHP. Add the following to your .htaccess file at the top.

    Needed for WooCommerce API

    RewriteRule ^index.php$ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]


  2. Try with below method

    https://example.com/wp-json/wc/v3/products?consumer_key=XXXXXXX&consumer_secret=XXXXXX
    

    The key is query_string_auth: true you need to force basic authentication as query string true under HTTPS

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search