I want to make an oAuth request in Ruby. I looked through a few examples, but none of them used oauth_token_secret and oauth_token to query, they used consumer_key and consumer_secret to get oauth_token_secret and oauth_token . But I already have oauth_token_secret and oauth_token .
For example, I tried to use
require 'rubygems' require 'oauth' consumer = OAuth::Consumer.new(consumer_key, consumer_secret, { :site=> "https://www.google.com", :scheme=> :header, :http_method=> :post, :request_token_path => "/accounts/OAuthGetRequestToken", :access_token_path => "/accounts/OAuthGetAccessToken", :authorize_path=> "/accounts/OAuthAuthorizeToken", :signature_method=>"RSA-SHA1"}, # :private_key_file=>PATH_TO_PRIVATE_KEY ) request_token = consumer.get_request_token() puts "Visit the following URL, log in if you need to, and authorize the app" puts request_token.authorize_url puts "When you've authorized that token, enter the verifier code you are assigned:" verifier = gets.strip puts "Converting request token into access token..." access_token=request_token.get_access_token(:oauth_verifier => verifier) puts "access_token.token --> #{access_token.token}" # But I initially have it puts "access_token.secret --> #{access_token.secret}" # But I initially have it
In my case, there are 4 secret keys:
consumer_key = "anonymous" consumer_secret = "anonymous" oauth_token_secret = "fdsfdsfdfdsfds" oauth_token = "fdsfdsfdfdsfdsdsdsdsdsdsds"
So what I need to do is to make an API request to a specific URL with some additional receive parameters and an oAuth token and get a response.
How to do it in Ruby?
ruby oauth
Alan coromano
source share