Hi I've gone through the official LinqToTwitter docs. I'm using single user authorization to get all tweets. But still getting "Bad Authentication" exception. What's wrong in the code?
private async void GetRecentTweets()
{
var auth = new SingleUserAuthorizer
{
CredentialStore = new SingleUserInMemoryCredentialStore
{
ConsumerKey = ConfigurationManager.AppSettings["consumerKey"],
ConsumerSecret = ConfigurationManager.AppSettings["consumerSecret"],
AccessToken = ConfigurationManager.AppSettings["accessToken"],
AccessTokenSecret = ConfigurationManager.AppSettings["accessTokenSecret"]
}
};
var twitterContext = new TwitterContext(auth);
var searchResponse =
await
(from search in twitterContext.Search
where search.Type == SearchType.Search &&
search.Query == "\"Donald Trump\""
select search)
.SingleOrDefaultAsync();
if (searchResponse != null && searchResponse.Statuses != null)
{
searchResponse.Statuses.ForEach(tweet =>
Console.WriteLine(
"User: {0}, Tweet: {1}",
tweet.User.ScreenNameResponse,
tweet.Text));
}
}
public MainWindow()
{
InitializeComponent();
GetRecentTweets();
}
My app.config file :
<?xml version="1.0" encoding="utf-8" ?>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
Your help is much appreciated!