Skip to content

Instantly share code, notes, and snippets.

@kreeger
Created June 16, 2013 19:10
Show Gist options
  • Save kreeger/5793042 to your computer and use it in GitHub Desktop.
Save kreeger/5793042 to your computer and use it in GitHub Desktop.
require 'oauth'
require 'uri'
key = ''
secret = ''
consumer = OAuth::Consumer.new(key, secret, { site: 'http://www.tumblr.com' })
request_token = consumer.get_request_token(exclude_callback: true)
puts request_token.authorize_url
result = gets.chomp
uri = URI.parse(result)
verifier = Hash[uri.query.split('&').map { |el| el.split('=') }]['oauth_verifier']
oauth_token = request_token.get_access_token(oauth_verifier: query['oauth_verifier'])
puts oauth_token.token
puts oauth_token.secret
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment