Created
December 27, 2010 21:33
-
-
Save kenmazaika/756576 to your computer and use it in GitHub Desktop.
Post to twitter after going through Oauth for Twitter
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
gem 'twitter_oauth', :git => 'git://github.com/moomerman/twitter_oauth.git' |
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
client = TwitterOAuth::Client.new( | |
:consumer_key => 'CONSUMER_APP_KEY', | |
:consumer_secret => 'CONSUMER_APP_SECRET' | |
) | |
if(params['oauth_verifier'].blank?) | |
session[:request_token] = client.request_token(:oauth_callback => 'http://localhost.com/deals/social') | |
return redirect_to session[:request_token].authorize_url | |
end | |
access_token = client.authorize( | |
session[:request_token].token, | |
session[:request_token].secret, | |
:oauth_verifier => params[:oauth_verifier] | |
) | |
client.update('This is a twitter post yo') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment