【问题标题】:Twitter4j: Authentication credentials (https://dev.twitter.com/pages/auth) were missing or incorrectTwitter4j:身份验证凭据 (https://dev.twitter.com/pages/auth) 丢失或不正确
【发布时间】:2016-08-22 16:46:41
【问题描述】:

我正在创建一个程序来使用 Twitter4j API 搜索具有给定关键字的推文,但在身份验证期间出现错误:

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 站点中提到的所有可能的解决方案,但它们对我不起作用。我花了几个小时来纠正错误,但仍然不知道是什么问题?

【问题讨论】:

  • 你能发布你的认证过程的代码吗?
  • 我没有使用 ConfigurationBuilder 代码进行身份验证,我只制作了 twitter4j.properties 文件,您将使用 twitter4j 库进行身份验证。
  • 你在 twitter4j.properties 文件中存储了什么?据我所知,您需要拥有 consumerKeyconsumerSecret,然后使用它您可以请求 OAuthRequestToken。看起来你使用了错误的令牌。
  • 我正在使用 oauth.consumerKey, oauth.consumerSecret, oauth.accessToken, oauth.accessTokenSecret 。我多次验证了所有这些。我应该在 Twitter 应用程序的回调 URL 中放置什么?

标签: java authentication twitter twitter4j


【解决方案1】:

实际上问题是,我在构建路径库中添加了 Twitter4j API 附带的所有 jar。我刚刚删除了除 twitter4j-core-4.0.4.jar 之外的所有其他 jar 并且它起作用了。

【讨论】:

    猜你喜欢
    • 2011-08-17
    • 2016-02-20
    • 1970-01-01
    • 2016-01-10
    • 1970-01-01
    • 2014-01-05
    • 2014-01-20
    • 1970-01-01
    • 2016-05-10
    相关资源
    最近更新 更多