This project has moved and is read-only. For the latest updates, please go here.

Simple example needed urgently

Aug 11, 2011 at 4:42 AM


I haven't a clue about where to start with the authorization thing. So far I have this:


oAuth = new OAuthTwitter ();

oAuth.OAuthConsumerKey =


oAuth.OAuthConsumerSecret =

"mySecret" ;

string loginUrl = oAuth.AuthorizationLinkGet(


"" ,


"", "", true );


var twitterCtx = new TwitterContext ();

//return Redirect(loginUrl); //(ASP.NET)


var publicTweets = from tweet in twitterCtx.Status


where tweet.Type == StatusType .Public


I just want the quickest, simplest way of authorizing the desktop app. I couldn't find much documentation.

Many thanks

select tweet; publicTweets.ToList().ForEach(tweet => AddItem(tweet.User.Name, tweet.Text));

Aug 11, 2011 at 4:51 AM


It looks like you found an old example; things have changed a lot since then.  The downloadable code has several example projects.  To get started, check out the LinqToTwitterDemo project.  It has a Program.cs file that shows how to set up OAuth with LinqToTwitter.


Aug 11, 2011 at 5:25 AM

Thanks, Joe. I found the sample and tried it.... however I have a few issues. Here is my code now:



auth = new SingleUserAuthorizer 


Credentials =


   ConsumerKey ="myKey" ,

   ConsumerSecret =

"mySecret" ,

   OAuthToken =

"" ,

   AccessToken =





If the OAuthToken and AccessToken and not correct, where do I find the values for these?

Also, the following query works:

var publicTweets =
from tweet in twitterCtx.Status
where tweet.Type == StatusType.Public
select tweet;

but when I add my user name as well like this:

var publicTweets =
from tweet in twitterCtx.Status
where tweet.Type == StatusType.Public
&& tweet.ScreenName == "myTweetAccountName"
select tweet;

that doesnt work. I did just add my first tweet to the account however, so maybe it is not picking it up yet? I don't know.



new InMemoryCredentials

Aug 11, 2011 at 8:13 AM

Okay I found the following info on Twitter's API page:

[Use the access token string as your "<tt>oauth_token</tt>" and the access token secret as your "<tt>oauth_token_secret</tt>" to sign requests with your own Twitter account...]

Then it shows the values for "Access token" and "Access token secret". So, are these supposed to match up with the "OAuthToken" and "AccessToken" properties in the post above? In which way?


Aug 11, 2011 at 9:46 AM

Right, nevermind the above; I got that all sorted. I can now retrieve tweets and also create new ones. I am however having an issue with the Retweet() method. I keep getting a "403 Forbidden" message. Any ideas?

Aug 11, 2011 at 11:14 AM

Nevermind; got it. Thanks for the help.  :-)