Jan 30 at 12:30 PM
Edited Jan 30 at 12:30 PM
|
Hi.
I'm trying to get a list of the chosen users latest feeds, using LinqToTwitter. Though i'm getting the following error:
"Parameter name: You must provide a consumerKey."
Funny thing is, i've already provided this. Here is my code:
SingleUserAuthorizer singleUserAuthorizer = new SingleUserAuthorizer()
{
Credentials = new InMemoryCredentials()
{
ConsumerKey = ConfigurationManager.AppSettings["twitterconsumerKey"],
ConsumerSecret = ConfigurationManager.AppSettings["twitterconsumerSecret"],
OAuthToken = ConfigurationManager.AppSettings["twitterOAuthToken"],
AccessToken = ConfigurationManager.AppSettings["twitterAccessToken"]
}
};
using (var twitterCtx = new TwitterContext(singleUserAuthorizer, "https://api.twitter.com/1/", "https://search.twitter.com/"))
{
var users =
(from tweet in twitterCtx.DirectMessage
where tweet.Type == DirectMessageType.SentTo select tweet).ToList();
}
Anyone got a suggestion or two? Thanks.
|
|
Coordinator
Jan 30 at 12:40 PM
|
Hi,
AppSettings["keyName"] specifies a key/value pair in the <appSettings /> element of your config file - there are examples on the
Samples page, downloadable source code, and a separate download for Console demos. You might want to verify that Credentials is populated by setting a breakpoint and examining singleUserAuthorizer.
Also, don't include the URLs when instantiating TwitterContext. Those URLs refer to Twitter API v1.0, but LINQ to Tw itter is now on Twitter API v1.1.
@JoeMayo
|
|
Feb 1 at 8:27 AM
Edited Feb 1 at 8:29 AM
|
I must have been really tired or totally blind that day. I've already been working a lot with AppSettings.config.
Thanks for waking me up JoeMayo. :D.
I managed to create a functioning page now with a Twitter feed list. :)
|
|