I am using LinqToTwitter to get all followers of some users. I face 401 unauthorized error, despite other API requests are working. Here is my code:
string consumerKey = ConfigurationManager.AppSettings["consumer_key"];
string consumerSecret = ConfigurationManager.AppSettings["consumer_secret"];
string tokenKey = ConfigurationManager.AppSettings["token"];
string tokenSecret = ConfigurationManager.AppSettings["token_secret"];
var auth = new SingleUserAuthorizer
{
Credentials = new SingleUserInMemoryCredentials
{
ConsumerKey = consumerKey,
ConsumerSecret = consumerSecret,
TwitterAccessToken = tokenKey,
TwitterAccessTokenSecret = tokenSecret
}
};
var twitterCtx = new TwitterContext(auth);
var followerIDs =
(from follower in twitterCtx.SocialGraph
where follower.Type == SocialGraphType.Followers &&
follower.UserID == ulong.Parse(userID)
select follower)
.SingleOrDefault();
followerIDs.IDs.ForEach(id => store(id, userID, followers));