woocommerce / wc-api-ruby

A Ruby wrapper for the WooCommerce API.
MIT License
69 stars 73 forks source link

API v1 for 2.6.x authentication error #24

Closed jensJJ closed 8 years ago

jensJJ commented 8 years ago

Hello,

thanks for this wrapper gem. I tried it and it works for the legacy API. I am using Version 2.6.1 Woocommerce and I get following error:

It says authentication error when using the new v1 method.

<HTTParty::Response:0x7fdbed3da4e8 parsed_response={"code"=>"woocommerce_rest_authentication_error", "message"=>"Invalid Signature - provided signature does not match.", "data"=>{"status"=>401}}, @response=#<Net::HTTPUnauthorized 401 Unauthorized readbody=true>, @headers={"date"=>["Sun, 26 Jun 2016 11:58:44 GMT"], "server"=>["Apache/2.4.20 (Unix) PHP/5.5.35 mod_wsgi/3.5 Python/3.5.1 OpenSSL/1.0.1p"], "x-powered-by"=>["PHP/5.5.35"], "x-content-type-options"=>["nosniff"], "access-control-expose-headers"=>["X-WP-Total, X-WP-TotalPages"], "access-control-allow-headers"=>["Authorization"], "content-length"=>["137"], "connection"=>["close"], "content-type"=>["application/json; charset=UTF-8"]}

claudiosanches commented 8 years ago

Show me your configuration.

jensJJ commented 8 years ago
def show
    @woocommerce_api = WooCommerce::API.new(@shop.url, @shop.consumer_key, @shop.consumer_secret,{wp_api: true, version: "wc/v1" })
end

@shop.url = http://127.0.0.1/woocommerce

Everything works when I omit {wp_api: true, version: "wc/v1" }

In Views I call:

<%= debug @woocommerce_api.get "orders" %>

claudiosanches commented 8 years ago

@jensJJ fixed in 1.2.1, thanks for let know about this bug.