Woocommerce API Version – /wc/v3/
Get method is working fine – to get all product list but when i try post method with add product its not working
I am getting below error message
{
"code": "woocommerce_rest_authentication_error",
"message": "Invalid signature - provided signature does not match.",
"data": {
"status": 401
}
}
below is more details
URL - http://*********/wp-json/wc/v3/products& tried without & as well
Auth type - Oath 1.0
Signature Method - HMAC-SHA1 & also tried sha256
Consumer Key ***
Consumer Secret ***
Timestamp - echo timestamp in wordpress and put same here
Nonce- Random number
Version - 1.0
Realm, verifier, Callback URL not sure what to put as i am trying same in POSTMAN
Check screenshot here – https://snipboard.io/6pkxTU.jpg
I have also tried some .htaccess update method from stackoverflow other query but its not working for me
3
Answers
First, please make sure you have valid API-keys.And Try with Basic Authentication.
Username:Consumer_Key
Password:Consumer_Secret
I have the same issue as well , and after searching with the
check_oauth_signature
inclass-wc-rest-authentication.php
that the problem ishash_equals( $signature, $consumer_signature )
return false. So I go through the whole variable related with $sinatue then something wired thing.$string_to_sign = $http_method . '&' . $base_request_uri . '&' . $query_string;
$query_string
would come with the header but if you set theBody
intoform-data
on Postman that form-data would be coming with header(aww.. really ridiculous, rid off that). In my scenario, click the raw and JSON instead for form-data, the hash issue would strike.in the Postman, click in Params, create two Keys called "consumer_key" and "consumer_secret" and fills the values with API Keys (consumer key and consume secret generated into woocomerce). In Authorization tab do not fill anything.