Reputation: 23
I just created a WooCommerce site, and when I try to get json data it displays error 401. I tried to access it through postman with basic auth, and through the link:
(mysite)/wp-json/wc/v2/products?consumer_key=XXXX&consumer_secret=XXXX
with keys that I have generated in WP. In both cases I am getting the same error.
Config: legacy api enabled, WC version 3.4.5, WP version 4.9.8, localhost server by Ampps.
Upvotes: 1
Views: 4923
Reputation: 576
Kindly use "Authorization" (besides the Parameter tab in Postman) choose Oath 1.0, then enter the consumer_key & consumer_secret then click the "SEND" button. That will work!
Upvotes: 3
Reputation:
Add this to top of your htaccess
file.
SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
Upvotes: 3
Reputation: 23
solved: the new legacy api has a different url to access woocommerce: (mysite)/wc-api/v2/...
for more details: https://woocommerce.github.io/woocommerce-rest-api-docs/v3.html?javascript#
Upvotes: 1