2016-04-28 177 views
0

我正在创建一个程序来搜索具有使用Twitter4j API的给定关键字的推文,但我在验证期间收到错误:Twitter4j:身份验证凭据(https://dev.twitter.com/pages/auth)丢失或不正确

Exception in thread "main" 401:Authentication credentials (https://dev.twitter.com/pages/auth) were missing or incorrect. Ensure that you have set valid consumer key/secret, access token/secret, and the system clock is in sync. 
message - Invalid or expired token. 
code - 89 

Relevant discussions can be found on the Internet at: 
    http://www.google.co.jp/search?q=506c3b98 or 
    http://www.google.co.jp/search?q=1136695b 
TwitterException{exceptionCode=[506c3b98-1136695b], statusCode=401, message=Invalid or expired token., code=89, retryAfter=-1, rateLimitStatus=null, version=4.0.4} 

我核实了所有令牌我twitter4j.properties文件,并尝试了所有的SO网站中提到的可能的解决方案,但他们并没有为我工作。我花了几个小时纠正错误,但仍然无能为力?

+0

你可以发布你的认证过程的代码吗? –

+0

我没有使用ConfigurationBuilder代码进行身份验证,我只做了twitter4j库要验证的twitter4j.properties文件。 –

+0

你将什么存储到_twitter4j.properties_文件中?据我所知,您需要** consumerKey **和** consumerSecret **,然后使用它您可以请求** OAuthRequestToken **。看起来你正在使用错误的标记。 –

回答

2

其实问题是,我在我的构建路径库中添加了所有带有Twitter4j API的罐子。我只是删除了除twitter4j-core-4.0.4.jar之外的所有其他罐子,并且它工作正常。

相关问题