Ruby on rails OAuth签名验证失败
我在设置具有两条腿身份验证的oauth提供程序时遇到一些问题 我使用的是oauth插件gem和oauth gem,除了我的“更新”请求之外,一切都正常。签名验证过程一直失败 以下是我正在做的: 在客户端中,我使用Ruby on rails OAuth签名验证失败,ruby-on-rails,ruby,oauth,oauth-ruby,Ruby On Rails,Ruby,Oauth,Oauth Ruby,我在设置具有两条腿身份验证的oauth提供程序时遇到一些问题 我使用的是oauth插件gem和oauth gem,除了我的“更新”请求之外,一切都正常。签名验证过程一直失败 以下是我正在做的: 在客户端中,我使用 oauth = OAuth::AccessToken.new(OAuth::Consumer.new(app_key, app_secret, :site => @api_endpoint)) oauth.get("http://localhost/api/v1/users/1"
oauth = OAuth::AccessToken.new(OAuth::Consumer.new(app_key, app_secret, :site => @api_endpoint))
oauth.get("http://localhost/api/v1/users/1")
oauth.post("http://localhost/api/v1/users", {:email => "testemail@mysite.com"})
oauth.put("http://localhost/api/v1/users", {:tags => ["some", "new", "tags"]})
oauth.delete("http://localhost/api/v1/users/1")
获取、发布和删除都可以通过身份验证,但更新失败
在服务器端,我设置了ClientApplication类
def self.verify_request(request, options = {}, &block)
begin
signature = OAuth::Signature.build(request, options, &block)
return false unless OauthNonce.remember(signature.request.nonce, signature.request.timestamp)
value = signature.verify
value
rescue OAuth::Signature::UnknownSignatureMethod => e
false
end
end
signature.verify在我的更新请求上失败,并传递其他3个请求。有人知道发生了什么吗?发现问题在于通过身体传递参数。
我用Addressable/uri将参数移动到url中,这就解决了这个问题。 在长度上会有点限制,但现在还可以