Skip to content

Instantly share code, notes, and snippets.

@xxx
Created September 2, 2010 19:07
Show Gist options
  • Save xxx/562766 to your computer and use it in GitHub Desktop.
Save xxx/562766 to your computer and use it in GitHub Desktop.
require 'YAML'
require 'twitter_oauth'
ck = 'consumer_key'
cs = 'consumer_secret'
client = TwitterOAuth::Client.new(
:consumer_key => ck,
:consumer_secret => cs
)
puts 'authenticating'
request_token = client.request_token(:oauth_callback => 'oob')
puts 'In a browser, go to:'
puts request_token.authorize_url
puts
print 'PIN: '
pin = $stdin.gets.chomp
access_token = client.authorize(
request_token.token,
request_token.secret,
:oauth_verifier => pin
)
puts
puts client.rate_limit_status.to_yaml
puts
puts "token: #{access_token.token}\n"
puts "secret: #{access_token.secret}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment