SlideShare ist ein Scribd-Unternehmen logo
1 von 28
Downloaden Sie, um offline zu lesen
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

Weitere ähnliche Inhalte

Andere mochten auch (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
 

Ähnlich wie Twitter4R OAuth

iPhoneアプリのTwitter連携
iPhoneアプリのTwitter連携iPhoneアプリのTwitter連携
iPhoneアプリのTwitter連携So Matsuda
 
OAuth and OEmbed
OAuth and OEmbedOAuth and OEmbed
OAuth and OEmbedleahculver
 
Building TweetEngine
Building TweetEngineBuilding TweetEngine
Building TweetEngineikailan
 
Using OAuth with PHP
Using OAuth with PHPUsing OAuth with PHP
Using OAuth with PHPDavid Ingram
 
OAuth 2.0 and Library
OAuth 2.0 and LibraryOAuth 2.0 and Library
OAuth 2.0 and LibraryKenji Otsuka
 
Spring Social - Messaging Friends & Influencing People
Spring Social - Messaging Friends & Influencing PeopleSpring Social - Messaging Friends & Influencing People
Spring Social - Messaging Friends & Influencing PeopleGordon 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 PassportMichael Peacock
 
Implementing OAuth with PHP
Implementing OAuth with PHPImplementing OAuth with PHP
Implementing OAuth with PHPLorna Mitchell
 
Webapp security (with notes)
Webapp security (with notes)Webapp security (with notes)
Webapp security (with notes)Igor Bossenko
 
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 DesignEric Maxwell
 
UC2013 Speed Geeking: Intro to OAuth2
UC2013 Speed Geeking: Intro to OAuth2UC2013 Speed Geeking: Intro to OAuth2
UC2013 Speed Geeking: Intro to OAuth2Aaron 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
 
OAuth2 Best Practices in Native Apps
OAuth2 Best Practices in Native AppsOAuth2 Best Practices in Native Apps
OAuth2 Best Practices in Native AppsJeff Fontas
 

Ähnlich wie 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
 
Oauth Php App
Oauth Php AppOauth Php App
Oauth Php App
 
Implementing OAuth with PHP
Implementing OAuth with PHPImplementing OAuth with PHP
Implementing OAuth with PHP
 
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)
 
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...
 
OAuth2 Best Practices in Native Apps
OAuth2 Best Practices in Native AppsOAuth2 Best Practices in Native Apps
OAuth2 Best Practices in Native Apps
 

Mehr von Susan Potter

Thinking in Properties
Thinking in PropertiesThinking in Properties
Thinking in PropertiesSusan 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 LearnedSusan 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 NixOSSusan 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 2016Susan 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 PipeSusan Potter
 
Functional Algebra: Monoids Applied
Functional Algebra: Monoids AppliedFunctional Algebra: Monoids Applied
Functional Algebra: Monoids AppliedSusan Potter
 
Dynamo: Not Just For Datastores
Dynamo: Not Just For DatastoresDynamo: Not Just For Datastores
Dynamo: Not Just For DatastoresSusan Potter
 
Distributed Developer Workflows using Git
Distributed Developer Workflows using GitDistributed Developer Workflows using Git
Distributed Developer Workflows using GitSusan Potter
 
Link Walking with Riak
Link Walking with RiakLink Walking with Riak
Link Walking with RiakSusan 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 CoffeeScriptSusan Potter
 
Designing for Concurrency
Designing for ConcurrencyDesigning for Concurrency
Designing for ConcurrencySusan Potter
 

Mehr von 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
 

Kürzlich hochgeladen

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontologyjohnbeverley2021
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 

Kürzlich hochgeladen (20)

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 

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