woocommerce_rest_cannot_view error when using the REST API
-
I cannot get the Woocommerce REST API to work at all.
I logged in as an administrator, created a pair of keys with read/write permission and opened the following URL:
https://example.com/wp-json/wc/v2/payment_gateways?consumer_key=ck_abc&consumer_secret=cs_abc
I got the following error:
{"code":"woocommerce_rest_cannot_view","message":"Sorry, you cannot list resources.","data":{"status":401}}
I opened the file that generated this error (woocommerce/packages/woocommerce-rest-api/src/Controllers/Version2/class-wc-rest-payment-gateways-v2-controller.php) and added the following on line 84 inside the
get_items_permissions_check()
function.var_dump( get_current_user_id() );
To my surprise it returned 0 even though I was logged into WordPress.
What is going on here?
The page I need help with: [log in to see the link]
- The topic ‘woocommerce_rest_cannot_view error when using the REST API’ is closed to new replies.