I am trying to authenticate to a 2 legged OAuth(1.0) system from ruby irb as follows using oauth ruby gem,
Step 1:
require 'oauth'
irb(main):038:0> consumer = OAuth::Consumer.new("key", "secret", :site => "site", :scheme => :query_string)
I got a response for this as,
=> #<OAuth::Consumer:0xba14be2c @key="{got valid key here}", @secret="{got valid secret here}", @options={:signature_method=>"HMAC-SHA1", :request_token_path=>"/oauth/request_token", :authorize_path=>"/oauth/authorize", :access_token_path=>"/oauth/access_token", :proxy=>nil, :scheme=>:query_string, :http_method=>:post, :oauth_version=>"1.0", :site=> "https://example.com/">
Step 2:
irb(main):039:0> access_token = OAuth::AccessToken.new consumer
=> #<OAuth::AccessToken:0xba144b7c @token="", @secret="", @consumer=#<OAuth::Consumer:0xba147430 @key="{got valid key here}", @secret="{got valid secret here}", @options={:signature_method=>"HMAC-SHA1", :request_token_path=>"/oauth/request_token", :authorize_path=>"/oauth/authorize", :access_token_path=>"/oauth/access_token", :proxy=>nil, :scheme=>:query_string, :http_method=>:post, :oauth_version=>"1.0", :site=>"https://example.com/"}>, @params={}>
Please see Token is empty above. I should have got the token here??
Step 3: Then i tried all the paths which i got from above,
irb(main):041:0> access_token.get("/oauth/authorize")
irb(main):041:0> access_token.get("/oauth/request_token")
irb(main):041:0> access_token.get("/oauth/access_token")
But for all the request am getting response as,
=> #<Net::HTTPNotFound 404 Not Found readbody=true>
I dono where i am making mistake, am i doing the request correctly, if not how should i authenticate to the 2legged oauth system in ruby. Or should i ask the service provider to check on their side.
Token field is empty in step 2, that is the problem??.
Can anyone please guide me in this?? Thanks in advance.