2011-03-04 175 views
0

我在使用双腿身份验证设置oauth提供程序时遇到了一些问题。OAuth签名验证失败

我使用oauth-plugin 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.post("http://localhost/api/v1/users", {:email => "[email protected]"}) 
oauth.put("http://localhost/api/v1/users", {:tags => ["some", "new", "tags"]}) 
oauth.delete("http://localhost/api/v1/users/1") 

GET,POST,并删除所有经过认证很好,但更新失败。

在服务器端,我有我的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个请求。任何人都知道发生了什么?

回答

1

原来问题在于将参​​数传递通过身体。
我将参数移动到带有Addressable/uri的url中,并解决了问题。 从长度来看,这会有点局限,但现在可以。