0
Twitter OauthAnd .Net Code<br />Mohamed Meligy<br />http://gurustop.net<br />http://twitter.com/meligy<br />
Application Registration<br />A Twitter user creates a Twitter Application<br />If the application is web based, it needs ...
Initializing The Process<br />User comes to the application and it decides to authenticate against Twitter<br />Applicatio...
User Authentication<br />The user is redirected to Twitter, the URL contains the “Oauth Request” to identify application a...
Obtaining the Access Token<br />The Application makes a request to Twitter including the “Oauth Request Token” and the “Ve...
Caching Credentials<br />The application needs at least one authorization process as before<br />The Access Token returned...
Sample Code<br />TweetSharp v 2.0<br />
Request Token & Redirect<br />
Getting Access Token<br />
Hints for Web Applications<br />The method GetAuthenticationUrl() has an overload that accepts a call-back URL for the use...
Using Cached Access Token<br />
Related Links<br />More Content Like This<br />http://gurustop.net<br />Twitter Developers Site<br />http://developer.twit...
Upcoming SlideShare
Loading in...5
×

Twitter OAuth With C#/.NET Code

9,119

Published on

Published in: Design, Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
9,119
On Slideshare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
44
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Transcript of "Twitter OAuth With C#/.NET Code"

  1. 1. Twitter OauthAnd .Net Code<br />Mohamed Meligy<br />http://gurustop.net<br />http://twitter.com/meligy<br />
  2. 2. Application Registration<br />A Twitter user creates a Twitter Application<br />If the application is web based, it needs to provide a URL. “Localhost” is not accepted as a domain for this URL<br />A Twitter Application gets two pieces of information<br />Consumer Key<br />Consumer Secret<br />A Twitter Application will use these in all coming requests.<br />
  3. 3. Initializing The Process<br />User comes to the application and it decides to authenticate against Twitter<br />Application makes a request using Consumer Key and Secret to obtain “Oauth Request Token”, which consists of two parts<br />Token<br />Token Secret<br />Application makes authentication URL including the “Oauth Request Token” parameter, and optionally a “Call-back URL” (if different than default URL in first step)<br />
  4. 4. User Authentication<br />The user is redirected to Twitter, the URL contains the “Oauth Request” to identify application authentication session<br />Assuming the Twitter User being logged in and authorizes the Application<br />If the application is a desktop application, Twitter gives the a user a number “Verifier” to manually write back to the application<br />If the application is a web application, the user is redirected back to the application call-back URL with a complex “Verifier” parameter in the URL<br />
  5. 5. Obtaining the Access Token<br />The Application makes a request to Twitter including the “Oauth Request Token” and the “Verifier”<br />It obtains an “Access Token”, likewise it consists of two-parts:<br />Token<br />Token Secret<br />The application needs to send the Consumer Key and Secret and Access Token in every future request that needs the Twitter User privileges<br />
  6. 6. Caching Credentials<br />The application needs at least one authorization process as before<br />The Access Token returned can be saved in session/DB/whatever and then re-used later<br />The application can later use the Access Token directly along with the Consumer Key / Secret to communicate with Twitter without going through any of the previous steps<br />
  7. 7. Sample Code<br />TweetSharp v 2.0<br />
  8. 8. Request Token & Redirect<br />
  9. 9. Getting Access Token<br />
  10. 10. Hints for Web Applications<br />The method GetAuthenticationUrl() has an overload that accepts a call-back URL for the user to be redirected to after obtaining verifer<br />The important part in RequestToken is the Token part, not the secret.<br />All parts of AccessToken are important and required<br />When the user is redirected back from Twitter to your application, you get the following QueryString parameters sent to you<br />oauth_token: The Token part of the Request Token<br />oauth_verifier: The verifier required to obtain the Access Token later<br />
  11. 11. Using Cached Access Token<br />
  12. 12. Related Links<br />More Content Like This<br />http://gurustop.net<br />Twitter Developers Site<br />http://developer.twitter.com<br />TweetSharp<br />http://tweetsharp.codeplex.com<br />Questions / Suggestions?<br />http://twitter.com/meligy<br />http://gurustop.net/contact<br />eng.meligy@gmail.com<br />
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×