SlideShare una empresa de Scribd logo
1 de 33
Twitter & OAuth 101 What’s this twit all about? Andy Badera (@andrewbadera) andrew@badera.us http://blog.badera.us/ TVUG October 2009
Background
The Numbers 79.7M users as of October 4th (all inclusive; ~50M “official”) $153M in funding as of end of September 28,000+ applications 30,000+ developers $23M+ invested in third party app startups
Growth April 2008-2009 Via TechCrunch
APIs REST API Search API Streaming API
REST API api.twitter.com Returns: XML, JSON, RSS, ATOM Read timelines Send tweets Read/send Direct Messages
Search API http://search.twitter.com/ Returns: JSON, ATOM Trends Terms (“from:andrewbadera”) Geolocation (“near:albany within:5miles”)
New Stuff Geolocation (improved) Group Lists Retweet API Address Book Apple Push Search API cleanup
Fab Four
Platform Team?
Trademark Controversy
What’s safe to use? Avoid “Twitter” Avoid bird graphics Avoid similar UI Biz sez: “Use ‘tweet.’”
Goals Register a new OAuth application Retrieve timelines Send Tweets Send/Receive Direct Messages Query Search API
.NET & Twitter Expect-100 Continue (HttpWebRequest) Request.ServicePoint.Expect100Continue = false; 302 Redirects if ( response.StatusCode == HttpStatusCode.Redirect ) { this.Url = new Uri( uri, response.Headers["Location"] ).ToString(); this.CookieContainer.Add( response.Cookies ); } 64-bit IDs (ulong - Convert.ToUInt64(“”)) LinqToTwitterhttp://www.codeplex.com/LinqToTwitter Tweetsharphttp://code.google.com/p/tweetsharp/ DotNetOpenAuthhttp://dotnetopenauth.net:8000/
RateLimit Ratelimit: 150 REST GETs/hour X-RateLimit X-RateLimit-Remaining X-RateLimit Whitelisted: 20000
Whitelisting http://twitter.com/help/request_whitelisting Turnaround time
In the beginning, HTTP Basic HTTP Basic Authorization Simple Familiar Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Basic Auth Pulls a Fail Whale
Downsides of HTTP Basic Auth Base64(byte[] “username:password”) Giving credentials away to third parties Password change Trust Rate limit by application IP
O-wot? Secure API authorization Blaine Cook (Twitter) Chris Messina (Ma.gnolia) Currently: OAuth 1.0A OAuth.net Shannon Whitley’s OAuthBase.cs
How OAuth Works Shared secret Nonce Timestamp
OAuth & Twitter Moves burden of ratelimit to user account Read/write (typical) Sign-in with Twitter “Guns for cash” – one time auth
Timelines
That’s cool, but …
Real-time Search User-Agent!
Common OAuth Gotchas
Technical Parameter sorting Parameter URL encoding Server clock
Social OAuth is not a panacea! Use common sense!
OAuth Best Practice “As with OpenID, OAuth is difficult to implement correctly and securely.  Pick a good, dependable library to take a dependency on instead.” 			--Andrew Arnott DotNetOpenAuth Author 			via email
Q&A Thanks for your time. Any questions?
Drinks! JJ Rafferty’s Route 9 North of Latham Traffic Circle on right Next to Price Chopper parking lot Across from Red Robin
Bibliography Alex Payne slideshare presentation: “Twitter API 2.0”,  http://www.slideshare.net/al3x/twitter-api-20 Mashable: “Twitter’s Value: 5 Eye-popping Stats”,  http://mashable.com/2009/10/04/twitter-stats/ Biz Stone blog entry: “May the Tweets Be With You” http://blog.twitter.com/2009/07/may-tweets-be-with-you.html
Resources Twitter API docs http://apiwiki.twitter.com/ Twitter Dev list http://groups.google.com/group/twitter-development-talk API blog http://apiblog.twitter.com/ (not well updated) @andrewbadera (http://twitter.com/andrewbadera) http://blog.badera.us/ andrew@badera.us

Más contenido relacionado

Similar a Twitter API & OAuth 101 TVUG October 2009

Twitter API Trends (Pubcon 2009)
Twitter API Trends (Pubcon 2009)Twitter API Trends (Pubcon 2009)
Twitter API Trends (Pubcon 2009)ayb
 
Seattle bot + Twitter data prezo
Seattle bot + Twitter data prezoSeattle bot + Twitter data prezo
Seattle bot + Twitter data prezoHarrison Neff
 
Rest API Security - A quick understanding of Rest API Security
Rest API Security - A quick understanding of Rest API SecurityRest API Security - A quick understanding of Rest API Security
Rest API Security - A quick understanding of Rest API SecurityMohammed Fazuluddin
 
Single-Page-Application & REST security
Single-Page-Application & REST securitySingle-Page-Application & REST security
Single-Page-Application & REST securityIgor Bossenko
 
Twarfing: Malicious Tweets
Twarfing: Malicious TweetsTwarfing: Malicious Tweets
Twarfing: Malicious TweetsCostin Raiu
 
Identity Enabling Web Services
Identity Enabling Web ServicesIdentity Enabling Web Services
Identity Enabling Web ServicesAshish Jain
 
Cloud security best practices in AWS by: Ankit Giri
Cloud security best practices in AWS by: Ankit GiriCloud security best practices in AWS by: Ankit Giri
Cloud security best practices in AWS by: Ankit GiriOWASP Delhi
 
Office 365 Authentication Process (oAuth Service Integration) - iXora Tech Se...
Office 365 Authentication Process (oAuth Service Integration) - iXora Tech Se...Office 365 Authentication Process (oAuth Service Integration) - iXora Tech Se...
Office 365 Authentication Process (oAuth Service Integration) - iXora Tech Se...iXora Solution Ltd.
 
Using OAuth with PHP
Using OAuth with PHPUsing OAuth with PHP
Using OAuth with PHPDavid Ingram
 
UserCentric Identity based Service Invocation
UserCentric Identity based Service InvocationUserCentric Identity based Service Invocation
UserCentric Identity based Service Invocationguestd5dde6
 
#tmeetup BirdHackers API 101
#tmeetup BirdHackers API 101#tmeetup BirdHackers API 101
#tmeetup BirdHackers API 101jstrellner
 
B-sides Las Vegas - social network security
B-sides Las Vegas - social network securityB-sides Las Vegas - social network security
B-sides Las Vegas - social network securityDamon Cortesi
 
Dial2Do : API Experience
Dial2Do : API ExperienceDial2Do : API Experience
Dial2Do : API ExperienceSean O'Sullivan
 
"Why Fake News Is Relevant" - Introduction to the Userfeeds Protocol
"Why Fake News Is Relevant" - Introduction to the Userfeeds Protocol"Why Fake News Is Relevant" - Introduction to the Userfeeds Protocol
"Why Fake News Is Relevant" - Introduction to the Userfeeds ProtocolUserfeeds.io
 
OWASPAPISecurity
OWASPAPISecurityOWASPAPISecurity
OWASPAPISecurityJie Liau
 
John Conroy
John ConroyJohn Conroy
John Conroyblogtalk
 
CIS 2015 Identity Relationship Management in the Internet of Things
CIS 2015 Identity Relationship Management in the Internet of ThingsCIS 2015 Identity Relationship Management in the Internet of Things
CIS 2015 Identity Relationship Management in the Internet of ThingsCloudIDSummit
 
Using Web 2.0 to Improve How TSA Does Business
Using Web 2.0 to Improve How TSA Does BusinessUsing Web 2.0 to Improve How TSA Does Business
Using Web 2.0 to Improve How TSA Does BusinessPeter Stinson
 

Similar a Twitter API & OAuth 101 TVUG October 2009 (20)

Secure Webservices
Secure WebservicesSecure Webservices
Secure Webservices
 
Twitter API Trends (Pubcon 2009)
Twitter API Trends (Pubcon 2009)Twitter API Trends (Pubcon 2009)
Twitter API Trends (Pubcon 2009)
 
Oauth
OauthOauth
Oauth
 
Seattle bot + Twitter data prezo
Seattle bot + Twitter data prezoSeattle bot + Twitter data prezo
Seattle bot + Twitter data prezo
 
Rest API Security - A quick understanding of Rest API Security
Rest API Security - A quick understanding of Rest API SecurityRest API Security - A quick understanding of Rest API Security
Rest API Security - A quick understanding of Rest API Security
 
Single-Page-Application & REST security
Single-Page-Application & REST securitySingle-Page-Application & REST security
Single-Page-Application & REST security
 
Twarfing: Malicious Tweets
Twarfing: Malicious TweetsTwarfing: Malicious Tweets
Twarfing: Malicious Tweets
 
Identity Enabling Web Services
Identity Enabling Web ServicesIdentity Enabling Web Services
Identity Enabling Web Services
 
Cloud security best practices in AWS by: Ankit Giri
Cloud security best practices in AWS by: Ankit GiriCloud security best practices in AWS by: Ankit Giri
Cloud security best practices in AWS by: Ankit Giri
 
Office 365 Authentication Process (oAuth Service Integration) - iXora Tech Se...
Office 365 Authentication Process (oAuth Service Integration) - iXora Tech Se...Office 365 Authentication Process (oAuth Service Integration) - iXora Tech Se...
Office 365 Authentication Process (oAuth Service Integration) - iXora Tech Se...
 
Using OAuth with PHP
Using OAuth with PHPUsing OAuth with PHP
Using OAuth with PHP
 
UserCentric Identity based Service Invocation
UserCentric Identity based Service InvocationUserCentric Identity based Service Invocation
UserCentric Identity based Service Invocation
 
#tmeetup BirdHackers API 101
#tmeetup BirdHackers API 101#tmeetup BirdHackers API 101
#tmeetup BirdHackers API 101
 
B-sides Las Vegas - social network security
B-sides Las Vegas - social network securityB-sides Las Vegas - social network security
B-sides Las Vegas - social network security
 
Dial2Do : API Experience
Dial2Do : API ExperienceDial2Do : API Experience
Dial2Do : API Experience
 
"Why Fake News Is Relevant" - Introduction to the Userfeeds Protocol
"Why Fake News Is Relevant" - Introduction to the Userfeeds Protocol"Why Fake News Is Relevant" - Introduction to the Userfeeds Protocol
"Why Fake News Is Relevant" - Introduction to the Userfeeds Protocol
 
OWASPAPISecurity
OWASPAPISecurityOWASPAPISecurity
OWASPAPISecurity
 
John Conroy
John ConroyJohn Conroy
John Conroy
 
CIS 2015 Identity Relationship Management in the Internet of Things
CIS 2015 Identity Relationship Management in the Internet of ThingsCIS 2015 Identity Relationship Management in the Internet of Things
CIS 2015 Identity Relationship Management in the Internet of Things
 
Using Web 2.0 to Improve How TSA Does Business
Using Web 2.0 to Improve How TSA Does BusinessUsing Web 2.0 to Improve How TSA Does Business
Using Web 2.0 to Improve How TSA Does Business
 

Más de Andrew Badera

Azure Machine Learning 101
Azure Machine Learning 101Azure Machine Learning 101
Azure Machine Learning 101Andrew Badera
 
Windows Azure: Table Store, Service Bus Topics, Push Notifications & Notifica...
Windows Azure: Table Store, Service Bus Topics, Push Notifications & Notifica...Windows Azure: Table Store, Service Bus Topics, Push Notifications & Notifica...
Windows Azure: Table Store, Service Bus Topics, Push Notifications & Notifica...Andrew Badera
 
WCF in .NET 4.0 - TVUG November 2010
WCF in .NET 4.0 - TVUG November 2010WCF in .NET 4.0 - TVUG November 2010
WCF in .NET 4.0 - TVUG November 2010Andrew Badera
 
SaaSGrid: What's it good for? (2 of 2)
SaaSGrid: What's it good for? (2 of 2)SaaSGrid: What's it good for? (2 of 2)
SaaSGrid: What's it good for? (2 of 2)Andrew Badera
 
I've Got SaaSGrid: Now What? (1 of 2)
I've Got SaaSGrid: Now What? (1 of 2)I've Got SaaSGrid: Now What? (1 of 2)
I've Got SaaSGrid: Now What? (1 of 2)Andrew Badera
 
WCF - Tech Valley Code Camp 2008
WCF - Tech Valley Code Camp 2008WCF - Tech Valley Code Camp 2008
WCF - Tech Valley Code Camp 2008Andrew Badera
 

Más de Andrew Badera (7)

Azure Machine Learning 101
Azure Machine Learning 101Azure Machine Learning 101
Azure Machine Learning 101
 
Windows Azure: Table Store, Service Bus Topics, Push Notifications & Notifica...
Windows Azure: Table Store, Service Bus Topics, Push Notifications & Notifica...Windows Azure: Table Store, Service Bus Topics, Push Notifications & Notifica...
Windows Azure: Table Store, Service Bus Topics, Push Notifications & Notifica...
 
ASP.NET MVC Web API
ASP.NET MVC Web APIASP.NET MVC Web API
ASP.NET MVC Web API
 
WCF in .NET 4.0 - TVUG November 2010
WCF in .NET 4.0 - TVUG November 2010WCF in .NET 4.0 - TVUG November 2010
WCF in .NET 4.0 - TVUG November 2010
 
SaaSGrid: What's it good for? (2 of 2)
SaaSGrid: What's it good for? (2 of 2)SaaSGrid: What's it good for? (2 of 2)
SaaSGrid: What's it good for? (2 of 2)
 
I've Got SaaSGrid: Now What? (1 of 2)
I've Got SaaSGrid: Now What? (1 of 2)I've Got SaaSGrid: Now What? (1 of 2)
I've Got SaaSGrid: Now What? (1 of 2)
 
WCF - Tech Valley Code Camp 2008
WCF - Tech Valley Code Camp 2008WCF - Tech Valley Code Camp 2008
WCF - Tech Valley Code Camp 2008
 

Último

A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
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
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
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
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
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
 
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
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024SynarionITSolutions
 

Último (20)

A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
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
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
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
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
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, ...
 
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
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 

Twitter API & OAuth 101 TVUG October 2009

  • 1. Twitter & OAuth 101 What’s this twit all about? Andy Badera (@andrewbadera) andrew@badera.us http://blog.badera.us/ TVUG October 2009
  • 3. The Numbers 79.7M users as of October 4th (all inclusive; ~50M “official”) $153M in funding as of end of September 28,000+ applications 30,000+ developers $23M+ invested in third party app startups
  • 4. Growth April 2008-2009 Via TechCrunch
  • 5. APIs REST API Search API Streaming API
  • 6. REST API api.twitter.com Returns: XML, JSON, RSS, ATOM Read timelines Send tweets Read/send Direct Messages
  • 7. Search API http://search.twitter.com/ Returns: JSON, ATOM Trends Terms (“from:andrewbadera”) Geolocation (“near:albany within:5miles”)
  • 8. New Stuff Geolocation (improved) Group Lists Retweet API Address Book Apple Push Search API cleanup
  • 12. What’s safe to use? Avoid “Twitter” Avoid bird graphics Avoid similar UI Biz sez: “Use ‘tweet.’”
  • 13. Goals Register a new OAuth application Retrieve timelines Send Tweets Send/Receive Direct Messages Query Search API
  • 14. .NET & Twitter Expect-100 Continue (HttpWebRequest) Request.ServicePoint.Expect100Continue = false; 302 Redirects if ( response.StatusCode == HttpStatusCode.Redirect ) { this.Url = new Uri( uri, response.Headers["Location"] ).ToString(); this.CookieContainer.Add( response.Cookies ); } 64-bit IDs (ulong - Convert.ToUInt64(“”)) LinqToTwitterhttp://www.codeplex.com/LinqToTwitter Tweetsharphttp://code.google.com/p/tweetsharp/ DotNetOpenAuthhttp://dotnetopenauth.net:8000/
  • 15. RateLimit Ratelimit: 150 REST GETs/hour X-RateLimit X-RateLimit-Remaining X-RateLimit Whitelisted: 20000
  • 17. In the beginning, HTTP Basic HTTP Basic Authorization Simple Familiar Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
  • 18. Basic Auth Pulls a Fail Whale
  • 19. Downsides of HTTP Basic Auth Base64(byte[] “username:password”) Giving credentials away to third parties Password change Trust Rate limit by application IP
  • 20. O-wot? Secure API authorization Blaine Cook (Twitter) Chris Messina (Ma.gnolia) Currently: OAuth 1.0A OAuth.net Shannon Whitley’s OAuthBase.cs
  • 21. How OAuth Works Shared secret Nonce Timestamp
  • 22. OAuth & Twitter Moves burden of ratelimit to user account Read/write (typical) Sign-in with Twitter “Guns for cash” – one time auth
  • 27. Technical Parameter sorting Parameter URL encoding Server clock
  • 28. Social OAuth is not a panacea! Use common sense!
  • 29. OAuth Best Practice “As with OpenID, OAuth is difficult to implement correctly and securely.  Pick a good, dependable library to take a dependency on instead.” --Andrew Arnott DotNetOpenAuth Author via email
  • 30. Q&A Thanks for your time. Any questions?
  • 31. Drinks! JJ Rafferty’s Route 9 North of Latham Traffic Circle on right Next to Price Chopper parking lot Across from Red Robin
  • 32. Bibliography Alex Payne slideshare presentation: “Twitter API 2.0”, http://www.slideshare.net/al3x/twitter-api-20 Mashable: “Twitter’s Value: 5 Eye-popping Stats”, http://mashable.com/2009/10/04/twitter-stats/ Biz Stone blog entry: “May the Tweets Be With You” http://blog.twitter.com/2009/07/may-tweets-be-with-you.html
  • 33. Resources Twitter API docs http://apiwiki.twitter.com/ Twitter Dev list http://groups.google.com/group/twitter-development-talk API blog http://apiblog.twitter.com/ (not well updated) @andrewbadera (http://twitter.com/andrewbadera) http://blog.badera.us/ andrew@badera.us

Notas del editor

  1. Who’s heard of Twitter? Who has at least one account? Who’s been using it longer than a year? Who uses a third-party app like Tweetdeck?
  2. Brainstorming event while Jack was at Odeo in 2006, started as internal service; really broke out at 2007 SXSW. Working name was “Status,” “twitch” was a suggested production name, but it wasn’t quite right for some people. Twitter was the word below it in the dictionary; “twttr” was the original form used, in the spirit of flickr & such. Jack Dorsey, Chairman, Former CEO, Founder, Evan Williams, CEO, Biz Stone, Creative Director. Union Square Ventures early and major backer. Other investors include
  3. Some apps have already been acquired by Twitter or third parties for significant sums. (Tweetdeck by Seesmic, Summize by Twitter)
  4. Well over 1 Billion tweets – the first tweet at or over a billion was written in late 2008 by a bot. Go figure. Over 5000 tweets/minute during Obama’s inauguration; now over 10,000-25,000/minute, or 250+ tweets/second. Hundreds of millions of requests served per day. Personally billing more in Twitter work alone in 2009 than I did in total independent consulting in 2008.
  5. Three different APIs. Mention XMPP. Mention Starling – Ruby persistent queue using memcached, developed in-house. Backend now runs on Scala (over 2009). Interface still runs on Ruby on Rails. Will be focusing on REST and Search APIs tonight.
  6. REST API can do everything a user can do, and more.
  7. Recognizes trends, with and without # hashtag syntax. Allows viewing of historical trends, searches for keywords, updates to or from specific users. Started out as Summize, acquired by Twitter in mid-2008. Is not 100% uniform when compared to main REST API. Will migrate to api.twitter.com. In order to correlate a result from the Search API with an actual user, you need to do a lookup against the main API – painful cost when it comes to ratelimiting.
  8. api.twitter.com is new. Twitter is also introducing API versioning. (ABOUT TIME!) New lat and long parameters, more accurate “near” searches. GeoRSS and GeoJSON. Address Book – allegedly “secure and spammer-hostile” method to find Twitter users given an email address.
  9. Alex Payne, platform lead, second engineer hired (after Blaine Cook, former lead, former VP)RaffiKrikorian, platform engineer, Marcel Molina, translator & platform engineer and former Rails core team member, Ryan Sarver, platform engineer.
  10. Twitter is “uncomfortable” use of the word “Tweet” (letter to unnamedapp developer.) MyTwitterButlerautofollow app -> MyPostButler. At least one other instance. Murky. Twitter unresponsive. Disappointing.
  11. Biz’s blog entry latersays use “tweet,” and talks about the trademark filing. Too bad, they lost the April 16, 2009 trademark filing. Sam Johnston’s blog entry. Use “tweet,” use “post,” use “chat,” don’t use “Twitter.”
  12. Twitter chokes on Expect headers – make sure to quash them! (Expect defines certain behavior expectations by client.) 302 spam countermeasure … #fail!
  13. Response to all REST calls includes:X-RateLimit-Limit the current limit in effectX-RateLimit-Remaining the number of hits remaining before you are rate limitedX-RateLimit-Reset the time the current rate limiting period ends in epoch time.
  14. Whitelisting: per account or per IP
  15. Who here is familiar with HTTP Basic Authorization? What does it look like? **mention source param**
  16. [Post update to Twitter using HTTP Basic Auth.] Well gee, that doesn’t seem that tough, and it works. So what’s wrong with it?
  17. Putting password on the wire – encoded, not encrypted! SSL solves the problem, but not everyone is/was using https calls, and SSL can be expensive. Ratelimit: 150 REST GET/hour.
  18. Not an authentication protocol per se, but is evolving into or being used as such. Mention 1.0 clickjacking issue. Mention PIN?
  19. Shared secret – OAuth access token. Nonce value. Timestamp. Signature hash digest of all parameters, sorted lexicographically.
  20. [Register new OAuth web app with Twitter. Walkthrough user approval process.]
  21. [Retrieve public timeline. Retrieve individual timeline. Retrieve friends timeline.]
  22. OK, pulling that information is nice, but I think what we’re probably all a little more interested in is the messaging aspect. [Send update. Send DM. Retrieve DMs.]
  23. [Query search API; term, username, near, tags. Mention TweetHook?]