I'm trying to authenticate to a webservice using 2legged oauth. I have the next one working java example creating the authenticated URL using the signpost library:
String consumerKey = "KEY";
String consumerSecret = "SECRET";
DefaultOAuthConsumer consumer = new DefaultOAuthConsumer(consumerKey, consumerSecret);
consumer.setTokenWithSecret(consumerKey, consumerSecret);
return consumer.sign(targetUrl);
And this generates an URL like this
And I'm trying to recreate it using ruby's oauth. My code looks now like this:
consumer = OAuth::Consumer.new(@creds[:key], @creds[:secret],
:site => "URL",
:scheme => :query_string)
token = OAuth::AccessToken.new(consumer)
token.get "METHOD"
And generates URLS like:
But I'm always getting an Unauthorized error, even if I manually set oauth_token to key (as signpost do). Looks like the nonce is invalid, but both of them are valid libraries to oauth
Can anyone help me?
Thanks in advance