2012-08-01 89 views
0

我正在使用AndroidTwitter項目https://github.com/lorensiuswlt/AndroidTwitter連接到Twitter併發送推文。我可以成功地使用Twitter進行授權,並且它說我已登錄,但是當我發佈推文時,出現此錯誤。 Android設備上的系統時間是正確的,我的oauth密鑰和密碼被填寫(登錄時沒有問題)。Android Twitter4j 401身份驗證錯誤

08-01 14:25:07.222: W/System.err(5527): 401:Authentication credentials (https://dev.twitter.com/docs/auth) were missing or incorrect. Ensure that you have set valid consumer key/secret, access token/secret, and the system clock is in sync. 
08-01 14:25:07.222: W/System.err(5527): error - Could not authenticate with OAuth. 
08-01 14:25:07.222: W/System.err(5527): request - /1/statuses/update.json 
08-01 14:25:07.222: W/System.err(5527): Relevant discussions can be found on the Internet at: 
08-01 14:25:07.222: W/System.err(5527):  http://www.google.co.jp/search?q=b2b52c28 or 
08-01 14:25:07.222: W/System.err(5527):  http://www.google.co.jp/search?q=1a591522 
08-01 14:25:07.222: W/System.err(5527): TwitterException{exceptionCode=[b2b52c28-1a591522],  statusCode=401, retryAfter=-1, rateLimitStatus=null, featureSpecificRateLimitStatus=null, version=3.0.0-SNAPSHOT(build: a5aafcad15add0fbc7a6583e337a1abbafa23435)} 
08-01 14:25:07.229: W/System.err(5527):  at twitter4j.internal.http.HttpClientImpl.request(HttpClientImpl.java:176) 
08-01 14:25:07.229: W/System.err(5527):  at twitter4j.internal.http.HttpClientWrapper.request(HttpClientWrapper.java:61) 
08-01 14:25:07.229: W/System.err(5527):  at twitter4j.internal.http.HttpClientWrapper.post(HttpClientWrapper.java:98) 
08-01 14:25:07.229: W/System.err(5527):  at twitter4j.TwitterImpl.post(TwitterImpl.java:1970) 
08-01 14:25:07.237: W/System.err(5527):  at twitter4j.TwitterImpl.updateStatus(TwitterImpl.java:415) 
08-01 14:25:07.237: W/System.err(5527):  at net.londatiga.android.TwitterApp.updateStatus(TwitterApp.java:106) 
08-01 14:25:07.237: W/System.err(5527):  at net.londatiga.android.TestPost$5.run(TestPost.java:106) 

回答

0

如果您剛剛設置了它,那麼您的Twitter應用程序可能仍設置爲只讀。在twitter設置控制檯中檢查您的應用程序的應用程序類型。確保在更改後重新生成訪問令牌。

+0

的確如此,我將它設置爲只讀。我試圖在Twitter上重新獲得訪問令牌,並且它們與之前一樣。我也嘗試重置我的使用者密鑰和密鑰,並使用新密鑰再次運行它,但是我得到相同的錯誤。 – Andy 2012-08-01 19:43:58

+0

當您更改應用類型時,可能需要一段時間才能更新Twitter。嘗試重新訪問設置頁面。如果它不再說只讀,則嘗試重新生成您的訪問令牌 – Krylez 2012-08-01 20:58:20