SlideShare a Scribd company logo
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

More Related Content

Viewers also liked

Deploying distributed software services to the cloud without breaking a sweat
Deploying distributed software services to the cloud without breaking a sweatDeploying distributed software services to the cloud without breaking a sweat
Deploying distributed software services to the cloud without breaking a sweat
Susan Potter
 
Understanding Uncertainty
Understanding UncertaintyUnderstanding Uncertainty
Understanding Uncertainty
Mark Rickerby
 
Работа экспертов (ГИА-2010)
Работа экспертов (ГИА-2010)Работа экспертов (ГИА-2010)
Работа экспертов (ГИА-2010)
Алексей Крылов
 
NAv6TF I Pv6 State Of Union Jan 2008
NAv6TF  I Pv6  State Of  Union  Jan 2008NAv6TF  I Pv6  State Of  Union  Jan 2008
NAv6TF I Pv6 State Of Union Jan 2008
digitaldivide
 
Relentless Refactoring
Relentless RefactoringRelentless Refactoring
Relentless RefactoringMark Rickerby
 
U 2010 Presentation 20070821a
U 2010 Presentation 20070821aU 2010 Presentation 20070821a
U 2010 Presentation 20070821adigitaldivide
 
Readme Driven Development
Readme Driven DevelopmentReadme Driven Development
Readme Driven DevelopmentMark Rickerby
 
Scalaz By Example (An IO Taster) -- PDXScala Meetup Jan 2014
Scalaz By Example (An IO Taster) -- PDXScala Meetup Jan 2014Scalaz By Example (An IO Taster) -- PDXScala Meetup Jan 2014
Scalaz By Example (An IO Taster) -- PDXScala Meetup Jan 2014
Susan Potter
 
Behaviour Driven Development
Behaviour Driven DevelopmentBehaviour Driven Development
Behaviour Driven DevelopmentMark Rickerby
 
Masturbation nightfall-mydoctortells.com
Masturbation nightfall-mydoctortells.comMasturbation nightfall-mydoctortells.com
Regaining Powerful Erection: Treatment of ED Without Medicines
Regaining Powerful Erection: Treatment of ED Without MedicinesRegaining Powerful Erection: Treatment of ED Without Medicines
Regaining Powerful Erection: Treatment of ED Without Medicines
SAMADHAN HEALTH STUDIO: Sexual Health Best World Class Premier Treatment India
 

Viewers also liked (13)

Deploying distributed software services to the cloud without breaking a sweat
Deploying distributed software services to the cloud without breaking a sweatDeploying distributed software services to the cloud without breaking a sweat
Deploying distributed software services to the cloud without breaking a sweat
 
Understanding Uncertainty
Understanding UncertaintyUnderstanding Uncertainty
Understanding Uncertainty
 
Работа экспертов (ГИА-2010)
Работа экспертов (ГИА-2010)Работа экспертов (ГИА-2010)
Работа экспертов (ГИА-2010)
 
Learning objectives
Learning objectivesLearning objectives
Learning objectives
 
NAv6TF I Pv6 State Of Union Jan 2008
NAv6TF  I Pv6  State Of  Union  Jan 2008NAv6TF  I Pv6  State Of  Union  Jan 2008
NAv6TF I Pv6 State Of Union Jan 2008
 
Relentless Refactoring
Relentless RefactoringRelentless Refactoring
Relentless Refactoring
 
U 2010 Presentation 20070821a
U 2010 Presentation 20070821aU 2010 Presentation 20070821a
U 2010 Presentation 20070821a
 
Readme Driven Development
Readme Driven DevelopmentReadme Driven Development
Readme Driven Development
 
Scalaz By Example (An IO Taster) -- PDXScala Meetup Jan 2014
Scalaz By Example (An IO Taster) -- PDXScala Meetup Jan 2014Scalaz By Example (An IO Taster) -- PDXScala Meetup Jan 2014
Scalaz By Example (An IO Taster) -- PDXScala Meetup Jan 2014
 
Behaviour Driven Development
Behaviour Driven DevelopmentBehaviour Driven Development
Behaviour Driven Development
 
The D3 Toolbox
The D3 ToolboxThe D3 Toolbox
The D3 Toolbox
 
Masturbation nightfall-mydoctortells.com
Masturbation nightfall-mydoctortells.comMasturbation nightfall-mydoctortells.com
Masturbation nightfall-mydoctortells.com
 
Regaining Powerful Erection: Treatment of ED Without Medicines
Regaining Powerful Erection: Treatment of ED Without MedicinesRegaining Powerful Erection: Treatment of ED Without Medicines
Regaining Powerful Erection: Treatment of ED Without Medicines
 

Similar to Twitter4R OAuth

iPhoneアプリのTwitter連携
iPhoneアプリのTwitter連携iPhoneアプリのTwitter連携
iPhoneアプリのTwitter連携So Matsuda
 
OAuth and OEmbed
OAuth and OEmbedOAuth and OEmbed
OAuth and OEmbed
leahculver
 
Building TweetEngine
Building TweetEngineBuilding TweetEngine
Building TweetEngineikailan
 
Some OAuth love
Some OAuth loveSome OAuth love
Some OAuth love
Nicolas Blanco
 
Using OAuth with PHP
Using OAuth with PHPUsing OAuth with PHP
Using OAuth with PHP
David Ingram
 
OAuth 2.0 and Library
OAuth 2.0 and LibraryOAuth 2.0 and Library
OAuth 2.0 and Library
Kenji Otsuka
 
Api security
Api security Api security
Api security
teodorcotruta
 
Spring Social - Messaging Friends & Influencing People
Spring Social - Messaging Friends & Influencing PeopleSpring Social - Messaging Friends & Influencing People
Spring Social - Messaging Friends & Influencing People
Gordon Dickens
 
How to get data from twitter (by hnnrrhm)
How to get data from twitter (by hnnrrhm)How to get data from twitter (by hnnrrhm)
How to get data from twitter (by hnnrrhm)
Hani Nurrahmi
 
Oauth2 and OWSM OAuth2 support
Oauth2 and OWSM OAuth2 supportOauth2 and OWSM OAuth2 support
Oauth2 and OWSM OAuth2 supportGaurav Sharma
 
An introduction to Laravel Passport
An introduction to Laravel PassportAn introduction to Laravel Passport
An introduction to Laravel Passport
Michael Peacock
 
Demystifying OAuth2 for PHP
Demystifying OAuth2 for PHPDemystifying OAuth2 for PHP
Demystifying OAuth2 for PHP
SWIFTotter Solutions
 
Implementing OAuth with PHP
Implementing OAuth with PHPImplementing OAuth with PHP
Implementing OAuth with PHP
Lorna Mitchell
 
Mining Georeferenced Data
Mining Georeferenced DataMining Georeferenced Data
Mining Georeferenced Data
Bruno Gonçalves
 
Webapp security (with notes)
Webapp security (with notes)Webapp security (with notes)
Webapp security (with notes)
Igor Bossenko
 
Oauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoftOauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoft
shyamraj55
 
Data Synchronization Patterns in Mobile Application Design
Data Synchronization Patterns in Mobile Application DesignData Synchronization Patterns in Mobile Application Design
Data Synchronization Patterns in Mobile Application Design
Eric Maxwell
 
UC2013 Speed Geeking: Intro to OAuth2
UC2013 Speed Geeking: Intro to OAuth2UC2013 Speed Geeking: Intro to OAuth2
UC2013 Speed Geeking: Intro to OAuth2
Aaron Parecki
 
APIdays Paris 2018 - Learning the OAuth Dance (Without Stepping on Anyone's T...
APIdays Paris 2018 - Learning the OAuth Dance (Without Stepping on Anyone's T...APIdays Paris 2018 - Learning the OAuth Dance (Without Stepping on Anyone's T...
APIdays Paris 2018 - Learning the OAuth Dance (Without Stepping on Anyone's T...
apidays
 

Similar to Twitter4R OAuth (20)

iPhoneアプリのTwitter連携
iPhoneアプリのTwitter連携iPhoneアプリのTwitter連携
iPhoneアプリのTwitter連携
 
OAuth and OEmbed
OAuth and OEmbedOAuth and OEmbed
OAuth and OEmbed
 
Building TweetEngine
Building TweetEngineBuilding TweetEngine
Building TweetEngine
 
Some OAuth love
Some OAuth loveSome OAuth love
Some OAuth love
 
Using OAuth with PHP
Using OAuth with PHPUsing OAuth with PHP
Using OAuth with PHP
 
OAuth 2.0 and Library
OAuth 2.0 and LibraryOAuth 2.0 and Library
OAuth 2.0 and Library
 
Api security
Api security Api security
Api security
 
Spring Social - Messaging Friends & Influencing People
Spring Social - Messaging Friends & Influencing PeopleSpring Social - Messaging Friends & Influencing People
Spring Social - Messaging Friends & Influencing People
 
How to get data from twitter (by hnnrrhm)
How to get data from twitter (by hnnrrhm)How to get data from twitter (by hnnrrhm)
How to get data from twitter (by hnnrrhm)
 
Oauth2 and OWSM OAuth2 support
Oauth2 and OWSM OAuth2 supportOauth2 and OWSM OAuth2 support
Oauth2 and OWSM OAuth2 support
 
An introduction to Laravel Passport
An introduction to Laravel PassportAn introduction to Laravel Passport
An introduction to Laravel Passport
 
Demystifying OAuth2 for PHP
Demystifying OAuth2 for PHPDemystifying OAuth2 for PHP
Demystifying OAuth2 for PHP
 
Implementing OAuth with PHP
Implementing OAuth with PHPImplementing OAuth with PHP
Implementing OAuth with PHP
 
Oauth Php App
Oauth Php AppOauth Php App
Oauth Php App
 
Mining Georeferenced Data
Mining Georeferenced DataMining Georeferenced Data
Mining Georeferenced Data
 
Webapp security (with notes)
Webapp security (with notes)Webapp security (with notes)
Webapp security (with notes)
 
Oauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoftOauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoft
 
Data Synchronization Patterns in Mobile Application Design
Data Synchronization Patterns in Mobile Application DesignData Synchronization Patterns in Mobile Application Design
Data Synchronization Patterns in Mobile Application Design
 
UC2013 Speed Geeking: Intro to OAuth2
UC2013 Speed Geeking: Intro to OAuth2UC2013 Speed Geeking: Intro to OAuth2
UC2013 Speed Geeking: Intro to OAuth2
 
APIdays Paris 2018 - Learning the OAuth Dance (Without Stepping on Anyone's T...
APIdays Paris 2018 - Learning the OAuth Dance (Without Stepping on Anyone's T...APIdays Paris 2018 - Learning the OAuth Dance (Without Stepping on Anyone's T...
APIdays Paris 2018 - Learning the OAuth Dance (Without Stepping on Anyone's T...
 

More from Susan Potter

Thinking in Properties
Thinking in PropertiesThinking in Properties
Thinking in Properties
Susan Potter
 
Champaign-Urbana Javascript Meetup Talk (Jan 2020)
Champaign-Urbana Javascript Meetup Talk (Jan 2020)Champaign-Urbana Javascript Meetup Talk (Jan 2020)
Champaign-Urbana Javascript Meetup Talk (Jan 2020)
Susan Potter
 
From Zero to Haskell: Lessons Learned
From Zero to Haskell: Lessons LearnedFrom Zero to Haskell: Lessons Learned
From Zero to Haskell: Lessons Learned
Susan Potter
 
Dynamically scaling a political news and activism hub (up to 5x the traffic i...
Dynamically scaling a political news and activism hub (up to 5x the traffic i...Dynamically scaling a political news and activism hub (up to 5x the traffic i...
Dynamically scaling a political news and activism hub (up to 5x the traffic i...
Susan Potter
 
Functional Operations (Functional Programming at Comcast Labs Connect)
Functional Operations (Functional Programming at Comcast Labs Connect)Functional Operations (Functional Programming at Comcast Labs Connect)
Functional Operations (Functional Programming at Comcast Labs Connect)
Susan Potter
 
From Zero to Application Delivery with NixOS
From Zero to Application Delivery with NixOSFrom Zero to Application Delivery with NixOS
From Zero to Application Delivery with NixOS
Susan Potter
 
From Zero To Production (NixOS, Erlang) @ Erlang Factory SF 2016
From Zero To Production (NixOS, Erlang) @ Erlang Factory SF 2016From Zero To Production (NixOS, Erlang) @ Erlang Factory SF 2016
From Zero To Production (NixOS, Erlang) @ Erlang Factory SF 2016
Susan Potter
 
Ricon/West 2013: Adventures with Riak Pipe
Ricon/West 2013: Adventures with Riak PipeRicon/West 2013: Adventures with Riak Pipe
Ricon/West 2013: Adventures with Riak Pipe
Susan Potter
 
Functional Algebra: Monoids Applied
Functional Algebra: Monoids AppliedFunctional Algebra: Monoids Applied
Functional Algebra: Monoids Applied
Susan Potter
 
Why Haskell
Why HaskellWhy Haskell
Why Haskell
Susan Potter
 
Dynamo: Not Just For Datastores
Dynamo: Not Just For DatastoresDynamo: Not Just For Datastores
Dynamo: Not Just For Datastores
Susan Potter
 
Distributed Developer Workflows using Git
Distributed Developer Workflows using GitDistributed Developer Workflows using Git
Distributed Developer Workflows using Git
Susan Potter
 
Link Walking with Riak
Link Walking with RiakLink Walking with Riak
Link Walking with Riak
Susan Potter
 
Writing Bullet-Proof Javascript: By Using CoffeeScript
Writing Bullet-Proof Javascript: By Using CoffeeScriptWriting Bullet-Proof Javascript: By Using CoffeeScript
Writing Bullet-Proof Javascript: By Using CoffeeScript
Susan Potter
 
Designing for Concurrency
Designing for ConcurrencyDesigning for Concurrency
Designing for Concurrency
Susan Potter
 

More from Susan Potter (15)

Thinking in Properties
Thinking in PropertiesThinking in Properties
Thinking in Properties
 
Champaign-Urbana Javascript Meetup Talk (Jan 2020)
Champaign-Urbana Javascript Meetup Talk (Jan 2020)Champaign-Urbana Javascript Meetup Talk (Jan 2020)
Champaign-Urbana Javascript Meetup Talk (Jan 2020)
 
From Zero to Haskell: Lessons Learned
From Zero to Haskell: Lessons LearnedFrom Zero to Haskell: Lessons Learned
From Zero to Haskell: Lessons Learned
 
Dynamically scaling a political news and activism hub (up to 5x the traffic i...
Dynamically scaling a political news and activism hub (up to 5x the traffic i...Dynamically scaling a political news and activism hub (up to 5x the traffic i...
Dynamically scaling a political news and activism hub (up to 5x the traffic i...
 
Functional Operations (Functional Programming at Comcast Labs Connect)
Functional Operations (Functional Programming at Comcast Labs Connect)Functional Operations (Functional Programming at Comcast Labs Connect)
Functional Operations (Functional Programming at Comcast Labs Connect)
 
From Zero to Application Delivery with NixOS
From Zero to Application Delivery with NixOSFrom Zero to Application Delivery with NixOS
From Zero to Application Delivery with NixOS
 
From Zero To Production (NixOS, Erlang) @ Erlang Factory SF 2016
From Zero To Production (NixOS, Erlang) @ Erlang Factory SF 2016From Zero To Production (NixOS, Erlang) @ Erlang Factory SF 2016
From Zero To Production (NixOS, Erlang) @ Erlang Factory SF 2016
 
Ricon/West 2013: Adventures with Riak Pipe
Ricon/West 2013: Adventures with Riak PipeRicon/West 2013: Adventures with Riak Pipe
Ricon/West 2013: Adventures with Riak Pipe
 
Functional Algebra: Monoids Applied
Functional Algebra: Monoids AppliedFunctional Algebra: Monoids Applied
Functional Algebra: Monoids Applied
 
Why Haskell
Why HaskellWhy Haskell
Why Haskell
 
Dynamo: Not Just For Datastores
Dynamo: Not Just For DatastoresDynamo: Not Just For Datastores
Dynamo: Not Just For Datastores
 
Distributed Developer Workflows using Git
Distributed Developer Workflows using GitDistributed Developer Workflows using Git
Distributed Developer Workflows using Git
 
Link Walking with Riak
Link Walking with RiakLink Walking with Riak
Link Walking with Riak
 
Writing Bullet-Proof Javascript: By Using CoffeeScript
Writing Bullet-Proof Javascript: By Using CoffeeScriptWriting Bullet-Proof Javascript: By Using CoffeeScript
Writing Bullet-Proof Javascript: By Using CoffeeScript
 
Designing for Concurrency
Designing for ConcurrencyDesigning for Concurrency
Designing for Concurrency
 

Recently uploaded

PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
Pierluigi Pugliese
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
DianaGray10
 
GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...
ThomasParaiso2
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Nexer Digital
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
DianaGray10
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
sonjaschweigert1
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
Neo4j
 

Recently uploaded (20)

PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
 
GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...GridMate - End to end testing is a critical piece to ensure quality and avoid...
GridMate - End to end testing is a critical piece to ensure quality and avoid...
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?Elizabeth Buie - Older adults: Are we really designing for our future selves?
Elizabeth Buie - Older adults: Are we really designing for our future selves?
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
 

Twitter4R OAuth

  • 1. Configuring your Twitter4R App with OAuth Susan Potter (@SusanPotter) Twitter4R (@t4ruby) March 2011
  • 2. 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
  • 3. 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
  • 4. 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
  • 5. 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
  • 6. 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
  • 7. 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
  • 8. 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
  • 9. 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
  • 10. 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
  • 11. 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
  • 12. 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
  • 13. 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
  • 14. 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
  • 15. 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
  • 16. 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
  • 17. 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
  • 18. 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
  • 19. 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
  • 20. 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
  • 21. 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’
  • 22. 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’
  • 23. 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’
  • 24. 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”)
  • 25. 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”)
  • 26. 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”)
  • 27. Fin HTH, if you have more questions: twitter4r-users@googlegroups.com
  • 28. Fin HTH, if you have more questions: twitter4r-users@googlegroups.com