I have a WordPress site setup with WooCommerce. The site is hosted on a Nginx server with PHP 7.2.
The problem I face is that external API calls to the site do not work.
For example, a call to the WC API V2 as: https://www.custommadewraps.com/wc-api/v2/orders?consumer_secret=cs_&consumer_key=ck_
Reports:
{"errors":[{"code":"woocommerce_api_authentication_error","message":"Consumer key
is missing."}]}
But the consumer key is there in the query string (consumer_key=ck_
).
The WC API calls are rewritten by WordPress as:
^wc-api/v([1-3]{1})(.*)?
index.php?wc-api-version=$matches[1]&wc-api-route=$matches[2]
And a call to the rewritten URL: https://www.custommadewraps.com/index.php?wc-api-version=2&wc-api-route=/orders?&consumer_secret=cs_&consumer_key=ck_
gives the expected response:
{"errors":[{"code":"woocommerce_api_authentication_error","message":"Consumer key
is invalid."}]}
It detects the consumer_key and reports that it is valid.
I am out of ideas for debugging so that is why I reach out to you guys (and girls).
What I have noticed is that the content of the $_GET
variable is different in both cases.
empty
array(0) {
}
vs:
array(4) {
["wc-api-version"]=>
string(1) "2"
["wc-api-route"]=>
string(8) "/orders?"
["consumer_secret"]=>
string(3) "cs_"
["consumer_key"]=>
string(3) "ck_"
}
All ideas are welcome.
Thanks in advance!
Pieter
https://htaccess.madewithlove.be
The new url is https://www.custommadewraps.com/index.php?wc-api-version=2%26wc-api-route=/orders
Thats why Consumer key is missing