[英]Linq to Twitter - Invalid / Expired Token
All, 所有,
I have the following code in a Windows Console Application. 我在Windows控制台应用程序中有以下代码。 I am using LinqtoTwitter ( http://linqtotwitter.codeplex.com/ ).
我正在使用LinqtoTwitter( http://linqtotwitter.codeplex.com/ )。 The line auth.IsAuthorized is returning true.
行auth.IsAuthorized返回true。 But it fails on the search with Invalid/Expired token error.
但是它在搜索中失败,并带有无效/过期的令牌错误。 I have checked and double-checked keys and tokens.
我已经检查并再次检查了密钥和令牌。 Any help would be greatly appreciated.
任何帮助将不胜感激。
static void processTweets()
{
var auth = new SingleUserAuthorizer
{
Credentials = new InMemoryCredentials
{
ConsumerKey = Utility.GetSetting("ConsumerKey"),
ConsumerSecret = Utility.GetSetting("ConsumerSecret"),
AccessToken = Utility.GetSetting("Accesstoken"),
OAuthToken = Utility.GetSetting("AccesstokenSecret")
}
};
auth.Authorize();
TwitterContext twitterCtx = new TwitterContext(auth);
if (auth == null || !auth.IsAuthorized)
{
}
var srch =
(from search in twitterCtx.Search
where search.Type == SearchType.Search &&
search.Query == "LINQ to Twitter" &&
search.Count == 7
select search)
.SingleOrDefault();
Console.WriteLine("\nQuery: {0}\n", srch.SearchMetaData.Query);
srch.Statuses.ForEach(entry =>
Console.WriteLine(
"ID: {0, -15}, Source: {1}\nContent: {2}\n",
entry.StatusID, entry.Source, entry.Text));
}
Your AccessToken and OAuthToken are backwards. 您的AccessToken和OAuthToken向后。 It might be easier to use SingleUserInMemoryCredentials.
使用SingleUserInMemoryCredentials可能会更容易。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.