• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Twitter4R OAuth
 

Twitter4R OAuth

on

  • 1,801 views

 

Statistics

Views

Total Views
1,801
Views on SlideShare
1,797
Embed Views
4

Actions

Likes
1
Downloads
3
Comments
0

2 Embeds 4

http://www.linkedin.com 3
https://www.linkedin.com 1

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Twitter4R OAuth Twitter4R OAuth Presentation Transcript

    • Configuring your Twitter4R App with OAuth Susan Potter (@SusanPotter) Twitter4R (@t4ruby) March 2011
    • OAuth. . . • sucks to configure • but it is better than users passing 3rd party apps their clear passwords • 3rd party apps don’t need to store passwords that are decryptable
    • OAuth. . . • sucks to configure • but it is better than users passing 3rd party apps their clear passwords • 3rd party apps don’t need to store passwords that are decryptable
    • OAuth. . . • sucks to configure • but it is better than users passing 3rd party apps their clear passwords • 3rd party apps don’t need to store passwords that are decryptable
    • In this screencast we will. . . • set up a new Twitter app https://twitter.com/apps/new • configure consumer tokens every app has a key and a secret; secret should be ’secret’ • getting access tokens for user apps need to retrieve access tokens for each user • use access tokens store access tokens (key and secret) for each user
    • In this screencast we will. . . • set up a new Twitter app https://twitter.com/apps/new • configure consumer tokens every app has a key and a secret; secret should be ’secret’ • getting access tokens for user apps need to retrieve access tokens for each user • use access tokens store access tokens (key and secret) for each user
    • In this screencast we will. . . • set up a new Twitter app https://twitter.com/apps/new • configure consumer tokens every app has a key and a secret; secret should be ’secret’ • getting access tokens for user apps need to retrieve access tokens for each user • use access tokens store access tokens (key and secret) for each user
    • In this screencast we will. . . • set up a new Twitter app https://twitter.com/apps/new • configure consumer tokens every app has a key and a secret; secret should be ’secret’ • getting access tokens for user apps need to retrieve access tokens for each user • use access tokens store access tokens (key and secret) for each user
    • Setting up a new Twitter app • Go to twitter.com • Login to your account • Fill in form at twitter.com/apps/new • Copy consumer tokens
    • Setting up a new Twitter app • Go to twitter.com • Login to your account • Fill in form at twitter.com/apps/new • Copy consumer tokens
    • Setting up a new Twitter app • Go to twitter.com • Login to your account • Fill in form at twitter.com/apps/new • Copy consumer tokens
    • Setting up a new Twitter app • Go to twitter.com • Login to your account • Fill in form at twitter.com/apps/new • Copy consumer tokens
    • Configuring consumer tokens # In a Rails 2.3 / 3.x app this might be # in: config/initializers/twitter4r.rb Twitter Client.configure do |config| config.oauth_consumer_token = CONSUMER_KEY config.oauth_consumer_secret = CONSUMER_SECRET end
    • Configuring consumer tokens # In a Rails 2.3 / 3.x app this might be # in: config/initializers/twitter4r.rb Twitter Client.configure do |config| config.oauth_consumer_token = CONSUMER_KEY config.oauth_consumer_secret = CONSUMER_SECRET end
    • Configuring consumer tokens # In a Rails 2.3 / 3.x app this might be # in: config/initializers/twitter4r.rb Twitter Client.configure do |config| config.oauth_consumer_token = CONSUMER_KEY config.oauth_consumer_secret = CONSUMER_SECRET end
    • Configuring consumer tokens # In a Rails 2.3 / 3.x app this might be # in: config/initializers/twitter4r.rb Twitter Client.configure do |config| config.oauth_consumer_token = CONSUMER_KEY config.oauth_consumer_secret = CONSUMER_SECRET end
    • Getting access tokens for a user, [1/2] # Using OAuth Ruby gem library helper in: # app/controller/application_controller.rb def redirect_to_twitter consumer = OAuth Consumer.new KEY, SECRET, :site => “https://twitter.com” token = consumer.get_request_token redirect_to(token.authorize_url) end
    • Getting access tokens for a user, [1/2] # Using OAuth Ruby gem library helper in: # app/controller/application_controller.rb def redirect_to_twitter consumer = OAuth Consumer.new KEY, SECRET, :site => “https://twitter.com” token = consumer.get_request_token redirect_to(token.authorize_url) end
    • Getting access tokens for a user, [1/2] # Using OAuth Ruby gem library helper in: # app/controller/application_controller.rb def redirect_to_twitter consumer = OAuth Consumer.new KEY, SECRET, :site => “https://twitter.com” token = consumer.get_request_token redirect_to(token.authorize_url) end
    • Getting access tokens for a user, [1/2] # Using OAuth Ruby gem library helper in: # app/controller/application_controller.rb def redirect_to_twitter consumer = OAuth Consumer.new KEY, SECRET, :site => “https://twitter.com” token = consumer.get_request_token redirect_to(token.authorize_url) end
    • Getting access tokens for a user, [2/2] # Using OAuth Ruby gem library in: # app/controller/oauth_controller.rb def create provider = params[:provider] case provider when ’twitter’ # bla bla bla end end # Remember to add the routes: match ’oauth/:provider/callback’ => ’oauth#create’
    • Getting access tokens for a user, [2/2] # Using OAuth Ruby gem library in: # app/controller/oauth_controller.rb def create provider = params[:provider] case provider when ’twitter’ # bla bla bla end end # Remember to add the routes: match ’oauth/:provider/callback’ => ’oauth#create’
    • Getting access tokens for a user, [2/2] # Using OAuth Ruby gem library in: # app/controller/oauth_controller.rb def create provider = params[:provider] case provider when ’twitter’ # bla bla bla end end # Remember to add the routes: match ’oauth/:provider/callback’ => ’oauth#create’
    • Using access tokens # Pass in access key/secret tokens to # Twitter Client.new call for each user client = Twitter Client.new :oauth_access => { :key => ACCESS_KEY, :secret => ACCESS_SECRET } client.status(:post, “Tweet from my OAuth-ed app”)
    • Using access tokens # Pass in access key/secret tokens to # Twitter Client.new call for each user client = Twitter Client.new :oauth_access => { :key => ACCESS_KEY, :secret => ACCESS_SECRET } client.status(:post, “Tweet from my OAuth-ed app”)
    • Using access tokens # Pass in access key/secret tokens to # Twitter Client.new call for each user client = Twitter Client.new :oauth_access => { :key => ACCESS_KEY, :secret => ACCESS_SECRET } client.status(:post, “Tweet from my OAuth-ed app”)
    • Fin HTH, if you have more questions: twitter4r-users@googlegroups.com
    • Fin HTH, if you have more questions: twitter4r-users@googlegroups.com