Ruby on rails 使用WoocommerceAPI的过滤器参数生成oauth签名时的问题

Ruby on rails 使用WoocommerceAPI的过滤器参数生成oauth签名时的问题,ruby-on-rails,oauth,oauth-2.0,woocommerce,woothemes,Ruby On Rails,Oauth,Oauth 2.0,Woocommerce,Woothemes,我正在尝试生成oauth签名,当我尝试使用过滤器[limit]=20创建签名时,我总是得到“无效签名-提供的签名不匹配”,但是当我排除过滤器[limit]=20时,生成的签名是有效的,请求工作正常 下面是我用来生成签名的代码 def generate_oauth_signature(endpoint, params, method) base_request_uri = CGI::escape(@api_url.to_s + endpoint.to_s) query_params

我正在尝试生成oauth签名,当我尝试使用过滤器[limit]=20创建签名时,我总是得到“无效签名-提供的签名不匹配”,但是当我排除过滤器[limit]=20时,生成的签名是有效的,请求工作正常

下面是我用来生成签名的代码

def generate_oauth_signature(endpoint, params, method)
    base_request_uri = CGI::escape(@api_url.to_s + endpoint.to_s)
    query_params = []
    params.each { |key, value| query_params.push(CGI::escape(key.to_s) + "%3D" + CGI::escape(value.to_s)) }
    query_string = query_params.join("%26")
    string_to_sign = method.to_s + "&" + base_request_uri + '&' + query_string
    return Base64.strict_encode64(OpenSSL::HMAC.digest(OpenSSL::Digest.new('sha256'), @consumer_secret, string_to_sign))
end
请您就可能出现的问题提出建议,谢谢。

此链接可能会有所帮助,因为您正在使用核心编码使WooCommerce REST API正常工作