skip to Main Content

Below issue was posted by me on https://github.com/XiaoFaye/WooCommerce.NET/issues/414 but since this may not be related at all to WooCommerce.Net but on a lowerlevel to Apache/Word/WooCommerc itself I am posting the same question here

I am really stuck with the famous error:

WebException: {“code”:”woocommerce_rest_authentication_error”,”message”:”Invalid signature – provided signature does not match.”,”data”:{“status”:401}}

FYI:

  • I have two wordpress instance running. One on my local machine and one on a remote server. The remote server is, as my local machine, in our company’s LAN
  • I am running WAMP on both machines to run Apache and host WordPress on port 80

  • The error ONLY occurs when trying to call the Rest api on the remote server. Connecting to the local rest api, the Rest Api/WooCommerceNet is working like a charm 🙂

  • From my local browser I can login to the remote WooCommerce instance without any problem
  • On the remote server I have defined WP_SITEURL as ‘http://[ip address]/webshop/ and WP_HOME as ‘http://[ip address]/webshopin wp-config.php

  • Calling the api url (http://[ip address]/webshop/wp-json/wc/v3/) from my local browser works OK. I get the normal JSON response

  • Authentication is done through the WooCommerce.Net wrapper which only requires a consumer key, consumer secret and the api url. I am sure I am using the right consumer key and secret and the proper api url http://[ip address]/webshop/wp-json/wc/v3/ (see previous bullet)
  • I already played around with the authorizedHeader variable (true/false) when instantiating a WooCommerce RestApi but this has no effect

Is there anybody that can point me into the direction of a solution?

Your help will be much appreciated!

2

Answers


  1. In my case, the problem was in my url adress. The URL Adress had two // begin wp-json

    Url Before the solution: http://localhost:8080/wordpress//wp-json/wc/v3/

    URL Now, and works ok: http://localhost:8080/wordpress/wp-json/wc/v3/

    I use with this sentence.

    RestAPI rest = new RestAPI(cUrlApi, Funciones.CK, Funciones.CS,false);
    WCObject wc = new WCObject(rest);
    var lstWooCategorias = await wc.Category.GetAll();

    I hope my answer helps you.

    Login or Signup to reply.
  2. Had the same issue. My fault was to define my url incorrect: http:// instead of https://.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search