woocommerce / wc-api-ruby

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

Params are not encoded in OAuth url #1

Closed danielhoey closed 9 years ago

danielhoey commented 9 years ago

The params in the url returned by OAuth::get_oauth_url are not encoded. This causes a problem (in particular) if the generated signature contains characters such as '+'. In this case the authentication with wooCommerce will fail as it expects '+' to be encoded as '%2B'.

I think that line 40 in woocommerce_api/oauth.rb should be something like this:

query_string = URI::encode(params.map{|key, value| "#{key}=#{CGI::escape(value.to_s)}"}.join("&"))

Probably the keys should be encoded also.

claudiosanches commented 9 years ago

Please submit a Pull Request.