Single User Authorization

Sep 13, 2013 at 12:29 PM
Hi,

I have been asked to fix a piece of code (ASP.NET 4.5 C#) that is not longer working as it was using an older version of LinqToTwitter and Twitter API 1. I have never worked with LinqToTwitter before and after a decent amount of effort, I am stuck and I hope someone here can help me.

I have an application for the twitter account in question and the following items from dev.twitter.com > My applications > OAuth settings:
Consumer key
Consumer secret
Access token
Access token secret

Based on what I have seen in the sample apps and read in the documentation and on the discussions here I have attempted the following:
var auth = new SingleUserAuthorizer
{
    Credentials = new SingleUserInMemoryCredentials
    {
        ConsumerKey = ConfigurationManager.AppSettings["twitterConsumerKey"],
        ConsumerSecret = ConfigurationManager.AppSettings["twitterConsumerSecret"],
        TwitterAccessToken = ConfigurationManager.AppSettings["twitterAccessToken"],
        TwitterAccessTokenSecret = ConfigurationManager.AppSettings["twitterAccessTokenSecret"]
    }
};

var twitterCtx = new TwitterContext(auth);

var res = twitterCtx.Status.Where(s => s.Type == StatusType.User).Take(4);

var tweets = queryResponse.ToList();
When I run the code, I get an error TwitterQueryException that "Could not authenticate you". What am I missing here? Have I not setup the application correctly? Am I not using LinqToTwitter correctly? Any help greatly appreciated!

Thanks.
Sep 13, 2013 at 12:44 PM
Got it working.

I recreated the access token and used the access token from the Details tab (dev.twitter.com) instead of the OAuth tool tab.

Thanks.