Twitter4j引发401身份验证错误

时间:2011-08-29 12:10:19

标签: twitter4j

尝试使用自己的凭据访问Twitter时,我收到以下身份验证错误。有人能说出问题所在吗?

401:身份验证凭据(https://dev.twitter.com/docs/auth)丢失或不正确。确保您已设置有效的conumer密钥/密钥,访问令牌/密钥和系统时钟同步。

Tests run: 6, Failures: 0, Errors: 5, Skipped: 0, Time elapsed: 4.953 sec <<< FAILURE!
showStatusTest(com.mycompany.twitter.test.TwitterClientTest)  Time elapsed: 0.672 sec  <<< ERROR!
401:Authentication credentials (https://dev.twitter.com/docs/auth) were missing or incorrect. Ensure that you have set valid conumer key/secret, access token/secret, and the system clock in in sync.
TwitterException{exceptionCode=[6b80c41c-1bd1da85], statusCode=401, retryAfter=-1, rateLimitStatus=null, featureSpecificRateLimitStatus=null, version=2.2.5-SNAPSHOT(build: 5f9c44cd0e0c1972f8d17653a226b9b6a3392ac2)}
    at twitter4j.internal.http.HttpClientImpl.request(HttpClientImpl.java:185)
    at twitter4j.internal.http.HttpClientWrapper.request(HttpClientWrapper.java:65)
    at twitter4j.internal.http.HttpClientWrapper.get(HttpClientWrapper.java:93)
    at twitter4j.TwitterImpl.get(TwitterImpl.java:1869)
    at twitter4j.TwitterImpl.showStatus(TwitterImpl.java:445)

2 个答案:

答案 0 :(得分:3)

401:Authentication credentials (https://dev.twitter.com/docs/auth) were missing or incorrect. Ensure that you have set valid conumer key/secret, access token/secret, and the system clock in in sync.

通过设置适当的system clock in sync来解决上述异常。

答案 1 :(得分:0)

您是否在应用程序中提供了正确的消费者密钥和访问令牌?阅读here