Getting Connected to Twitter with OAuth

Download (67MB, 11:24)
alternative download for iPod & iPhone (23.6MB, 11:24)
require 'rubygems' require 'twitter' token = "TWITTER_TOKEN_GOES_HERE" secret = "TWITTER_SECRET_GOES_HERE" oauth = Twitter::OAuth.new(token, secret) token2 = oauth.request_token.token secret2 = oauth.request_token.secret puts "> redirecting to Twitter to authorize account..." %x(open #{oauth.request_token.authorize_url}) print "> what was the PIN twitter provided to you? " pin = gets.chomp puts "PIN: #{pin}" begin oauth.authorize_from_request(token2, secret2, pin) puts "> atoken: #{oauth.access_token.token}" puts "> asecret: #{oauth.access_token.secret}" rescue OAuth::Unauthorized puts "> FAIL!" end
  social
  description
In this screencast, I show you how to use the Twitter gem to connect to Twitter, and we clarify some of the difficulties that comes with learning OAuth.
  author
Eric Berry on Sep 18, 2009
  tags
  sponsors
JumpstartLab
Clutterpad - Manage your clutter
PeepCode - Professional Web Development Screencasts
Groovy Magazine
SitePoint CSS
Learnivore!
Advertise Here
 
Main_bottom