woocommerce-rest-api-js-lib: 401 error - Invalid signature - provided signature does not match

Hi,

Following error gets returned when calling an endpoint.

{
code: 'woocommerce_rest_authentication_error',
message: 'Invalid signature - provided signature does not match.',
data: { status: 401 }
}

I am providing valid consumerKey and consumerSecret values. Can someone take a look?

Thanks!

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Comments: 16 (2 by maintainers)

Most upvoted comments

I had the same error. Fixed this by setting the Site Address in (Wordpress general settings) the same as WordPress Address

This worked for me: add queryStringAuth: true in the config. Like this:

const api = new WooCommerceRestApi({
  url: "http://example.com",
  consumerKey: "ck_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  consumerSecret: "cs_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  queryStringAuth: true
});

I solved the problem by adding the content type application/json to the header of the axios configuration.

{
        url: "http://localhost",
        consumerKey: "ck_6a4191390d71922ac915b32ad717dc17e2f084c8",
        consumerSecret: "cs_8019fd5fcbd519cfecdb532b7685e093abb68dd5",
        axiosConfig: {
            headers: {'Content-Type': 'application/json'},
        }
 }