ruby on rails - OAuth signature verification fails -
i'm having problem setting oauth provider two-legged authentication.
i'm using oauth-plugin gem , oauth gem, works fine except "update" requests. signature verification process keeps failing.
here i'm doing:
in client, i'm using
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")
get, post , delete go through authentication fine, update fails.
on server side, have clientapplication class set
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 fails on update requests , passes on other 3 requests. know what's happening?
turns out problem passing params through body.
moved params url addressable/uri, , fixed problem. it's gonna little limiting in terms of length, ok now.
Comments
Post a Comment