Created
May 3, 2010 13:05
-
-
Save mirakui/388067 to your computer and use it in GitHub Desktop.
To get twitter/oauth access token
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'twitter_oauth' | |
print 'Consumer Key> ' | |
consumer_key = gets.chomp | |
print 'Consumer Secret> ' | |
consumer_secret = gets.chomp | |
t = TwitterOAuth::Client.new( | |
: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( | |
req.token, | |
req.secret, | |
: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