2011-08-29 85 views
3

嘗試使用我自己的憑據訪問Twitter時出現以下驗證錯誤。有人可以告訴問題可能是什麼?Twitter4j引發401驗證錯誤

401:身份驗證憑據(https://dev.twitter.com/docs/auth)丟失或不正確。確保您已設置有效的用戶密鑰/密碼,訪問令牌/密碼和系統時鐘同步。

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) 

回答

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解決。

+0

什麼是系統時鐘以及如何同步它? – Dharmendra

+0

@Dharmendra - 即系統時鐘不同步。不知道你正在使用哪種發行版,但同步時鐘使它爲我工作。 – diya

+0

我必須同步哪個時鐘?是系統時鐘還是仿真器時鐘?請給出描述? – Dharmendra

0

您是否在應用程序中提供了正確的使用者密鑰和訪問令牌..?閱讀here