How to authenticate custom API endpoint in WooCommerce

Question

I have created custom API, which is working fine, but I am not able to authenticate it, it returns result without checking for keys

I have created consumer key and secret key from admin.

How to validate request to API.

I tried one solution, which is working as expected but my question is,

what is the standard way of authentication custom API

my current solution

require_once '/woocommerce/includes/legacy/api/v1/class-wc-api-authentication.php';
$test = new WC_API_Authentication();
$user = wp_get_current_user();
$test->authenticate($user);
0
, , Surjan Raghuwanshi 1 year 2019-12-21T07:49:41-05:00 0 Answers 88 views 0

Leave an answer

Browse
Browse