Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
To get twitter/oauth access token
require 'twitter_oauth'
print 'Consumer Key> '
consumer_key = gets.chomp
print 'Consumer Secret> '
consumer_secret = gets.chomp
t =
:consumer_key => consumer_key,
:consumer_secret => consumer_secret
req = t.request_token
puts 'OK'
puts "please access and get PIN: #{req.authorize_url}"
print 'PIN> '
pin = gets.to_i
acc = t.authorize(
:oauth_verifier => pin
puts "Authorized: #{t.authorized?}"
puts "Access Token: #{acc.token}"
puts "Access Secret: #{acc.secret}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment