LinqToTwitter Authorization Help

I use LinqToTwitter (http://linqtotwitter.codeplex.com/), but I do not know where to start with authorization. So far I have this:

var oAuth = new OAuthTwitter (); oAuth.OAuthConsumerKey ="mykey"; oAuth.OAuthConsumerSecret ="mySecret" ; string loginUrl = oAuth.AuthorizationLinkGet( "https://api.twitter.com/oauth/request_token" , "https://api.twitter.com/oauth/authorize", "", true ); var twitterCtx = new TwitterContext (); //return Redirect(loginUrl); //(ASP.NET) var publicTweets = from tweet in twitterCtx.Status where tweet.Type == StatusType .Public select tweet; publicTweets.ToList().ForEach(tweet => AddItem(tweet.User.Name, tweet.Text)); 

I just need the fastest and easiest way to authorize a desktop application. I could not find much documentation.

FYI - It will not be for multiple users ... I will have one username and password that will always be used ... if this helps make it easier.

Thank you very much

+4
source share
1 answer

Here is a working example:

 var auth = new SingleUserAuthorizer { Credentials = new InMemoryCredentials { ConsumerKey = ConfigurationManager.AppSettings["TwitterConsumerKey"], ConsumerSecret = ConfigurationManager.AppSettings["TwitterConsumerSecret"], OAuthToken = ConfigurationManager.AppSettings["TwitterAccessToken"], AccessToken = ConfigurationManager.AppSettings["TwitterAccessTokenSecret"] } }; using (var db = new TwitterContext(auth)) { string search = Server.UrlEncode(txtSearch.Text.Trim()); var list = db.User .Where(u => u.Type == UserType.Search && u.Query == searchExpression && u.Page == 1 ) .ToList(); } 
+1
source

All Articles