在 Android 应用程序中获取 Twitter 的访问令牌时出错
在尝试使用 Twitter 验证我的 Android 应用程序时,我的 logcat 中出现以下错误
除了 Twitter 的用户名和密码正确外,消息框还显示错误“我们无法登录您”进入推特。请稍后再试。'
10-24 12:28:24.433: INFO/TwitterService#showProgressDialog(3167): Activity Class Name: com.ap.ui.ArticleActivity
10-24 12:28:25.089: ERROR/TwitterService#login(3167): Error obtaining access token for Twitter.
10-24 12:28:25.089: ERROR/TwitterService#login(3167): TwitterException{exceptionCode=[e07c50ee-0000d883 1ac06e3f-626a12a6 1ac06e3f-626a127b 1ac06e3f-626a127b 1ac06e3f-626a127b], statusCode=-1, retryAfter=0, rateLimitStatus=null, version=2.1.4-SNAPSHOT(build: d2ffce58eec309979a5286d29990e468b0e04942)}
10-24 12:28:25.089: ERROR/TwitterService#login(3167): at twitter4j.http.OAuthAuthorization.getOAuthAccessToken(OAuthAuthorization.java:185)
10-24 12:28:25.089: ERROR/TwitterService#login(3167): at twitter4j.TwitterOAuthSupportBaseImpl.getOAuthAccessToken(TwitterOAuthSupportBaseImpl.java:108)
10-24 12:28:25.089: ERROR/TwitterService#login(3167): at twitter4j.Twitter.getOAuthAccessToken(Twitter.java:54)
10-24 12:28:25.089: ERROR/TwitterService#login(3167): at com.ap.service.social.TwitterService.login(TwitterService.java:51)
10-24 12:28:25.089: ERROR/TwitterService#login(3167): at com.ap.widgets.twitter.TwitterAccountDialog$LoginRunnable.run(TwitterAccountDialog.java:156)
10-24 12:28:25.089: ERROR/TwitterService#login(3167): at java.lang.Thread.run(Thread.java:1096)
10-24 12:28:25.089: ERROR/TwitterService#login(3167): Caused by: TwitterException{exceptionCode=[1ac06e3f-626a12a6 1ac06e3f-626a127b 1ac06e3f-626a127b 1ac06e3f-626a127b], statusCode=-1, retryAfter=0, rateLimitStatus=null, version=2.1.4-SNAPSHOT(build: d2ffce58eec309979a5286d29990e468b0e04942)}
10-24 12:28:25.089: ERROR/TwitterService#login(3167): at twitter4j.internal.http.HttpClientImpl.request(HttpClientImpl.java:323)
10-24 12:28:25.089: ERROR/TwitterService#login(3167): at twitter4j.internal.http.HttpClientWrapper.request(HttpClientWrapper.java:72)
10-24 12:28:25.089: ERROR/TwitterService#login(3167): at twitter4j.internal.http.HttpClientWrapper.post(HttpClientWrapper.java:103)
10-24 12:28:25.089: ERROR/TwitterService#login(3167): at twitter4j.http.OAuthAuthorization.getOAuthAccessToken(OAuthAuthorization.java:178)
10-24 12:28:25.089: ERROR/TwitterService#login(3167): ... 5 more
10-24 12:28:25.089: ERROR/TwitterService#login(3167): Caused by: javax.net.ssl.SSLException: Not trusted server certificate
10-24 12:28:25.089: ERROR/TwitterService#login(3167): at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:360)
10-24 12:28:25.089: ERROR/TwitterService#login(3167): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.getSecureSocket(HttpConnection.java:168)
10-24 12:28:25.089: ERROR/TwitterService#login(3167): at org.apache.harmony.luni.internal.net.www.protocol.https.HttpsURLConnection$HttpsEngine.connect(HttpsURLConnection.java:398)
10-24 12:28:25.089: ERROR/TwitterService#login(3167): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.sendRequest(HttpURLConnection.java:1224)
10-24 12:28:25.089: ERROR/TwitterService#login(3167): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.doRequestInternal(HttpURLConnection.java:1558)
10-24 12:28:25.089: ERROR/TwitterService#login(3167): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.doRequest(HttpURLConnection.java:1551)
10-24 12:28:25.089: ERROR/TwitterService#login(3167): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1145)
10-24 12:28:25.089: ERROR/TwitterService#login(3167): at org.apache.harmony.luni.internal.net.www.protocol.https.HttpsURLConnection.getOutputStream(HttpsURLConnection.java:262)
10-24 12:28:25.089: ERROR/TwitterService#login(3167): at twitter4j.internal.http.HttpClientImpl.request(HttpClientImpl.java:280)
10-24 12:28:25.089: ERROR/TwitterService#login(3167): ... 8 more
10-24 12:28:25.089: ERROR/TwitterService#login(3167): Caused by: java.security.cert.CertificateException: java.security.cert.CertPathValidatorException: TrustAnchor for CertPath not found.
10-24 12:28:25.089: ERROR/TwitterService#login(3167): at org.apache.harmony.xnet.provider.jsse.TrustManagerImpl.checkServerTrusted(TrustManagerImpl.java:168)
10-24 12:28:25.089: ERROR/TwitterService#login(3167): at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:355)
10-24 12:28:25.089: ERROR/TwitterService#login(3167): ... 16 more
10-24 12:28:25.089: ERROR/TwitterService#login(3167): Caused by: java.security.cert.CertPathValidatorException: TrustAnchor for CertPath not found.
10-24 12:28:25.089: ERROR/TwitterService#login(3167): at org.bouncycastle.jce.provider.PKIXCertPathValidatorSpi.engineValidate(PKIXCertPathValidatorSpi.java:149)
10-24 12:28:25.089: ERROR/TwitterService#login(3167): at java.security.cert.CertPathValidator.validate(CertPathValidator.java:211)
10-24 12:28:25.089: ERROR/TwitterService#login(3167): at org.apache.harmony.xnet.provider.jsse.TrustManagerImpl.checkServerTrusted(TrustManagerImpl.java:164)
10-24 12:28:25.089: ERROR/TwitterService#login(3167): ... 17 more
I got the following error in my logcat while trying to authenticate my android application with Twitter
Besides the username and password are correct for twitter, the message box shows error as'We are unable to log you into Twitter. Please try again later.'
10-24 12:28:24.433: INFO/TwitterService#showProgressDialog(3167): Activity Class Name: com.ap.ui.ArticleActivity
10-24 12:28:25.089: ERROR/TwitterService#login(3167): Error obtaining access token for Twitter.
10-24 12:28:25.089: ERROR/TwitterService#login(3167): TwitterException{exceptionCode=[e07c50ee-0000d883 1ac06e3f-626a12a6 1ac06e3f-626a127b 1ac06e3f-626a127b 1ac06e3f-626a127b], statusCode=-1, retryAfter=0, rateLimitStatus=null, version=2.1.4-SNAPSHOT(build: d2ffce58eec309979a5286d29990e468b0e04942)}
10-24 12:28:25.089: ERROR/TwitterService#login(3167): at twitter4j.http.OAuthAuthorization.getOAuthAccessToken(OAuthAuthorization.java:185)
10-24 12:28:25.089: ERROR/TwitterService#login(3167): at twitter4j.TwitterOAuthSupportBaseImpl.getOAuthAccessToken(TwitterOAuthSupportBaseImpl.java:108)
10-24 12:28:25.089: ERROR/TwitterService#login(3167): at twitter4j.Twitter.getOAuthAccessToken(Twitter.java:54)
10-24 12:28:25.089: ERROR/TwitterService#login(3167): at com.ap.service.social.TwitterService.login(TwitterService.java:51)
10-24 12:28:25.089: ERROR/TwitterService#login(3167): at com.ap.widgets.twitter.TwitterAccountDialog$LoginRunnable.run(TwitterAccountDialog.java:156)
10-24 12:28:25.089: ERROR/TwitterService#login(3167): at java.lang.Thread.run(Thread.java:1096)
10-24 12:28:25.089: ERROR/TwitterService#login(3167): Caused by: TwitterException{exceptionCode=[1ac06e3f-626a12a6 1ac06e3f-626a127b 1ac06e3f-626a127b 1ac06e3f-626a127b], statusCode=-1, retryAfter=0, rateLimitStatus=null, version=2.1.4-SNAPSHOT(build: d2ffce58eec309979a5286d29990e468b0e04942)}
10-24 12:28:25.089: ERROR/TwitterService#login(3167): at twitter4j.internal.http.HttpClientImpl.request(HttpClientImpl.java:323)
10-24 12:28:25.089: ERROR/TwitterService#login(3167): at twitter4j.internal.http.HttpClientWrapper.request(HttpClientWrapper.java:72)
10-24 12:28:25.089: ERROR/TwitterService#login(3167): at twitter4j.internal.http.HttpClientWrapper.post(HttpClientWrapper.java:103)
10-24 12:28:25.089: ERROR/TwitterService#login(3167): at twitter4j.http.OAuthAuthorization.getOAuthAccessToken(OAuthAuthorization.java:178)
10-24 12:28:25.089: ERROR/TwitterService#login(3167): ... 5 more
10-24 12:28:25.089: ERROR/TwitterService#login(3167): Caused by: javax.net.ssl.SSLException: Not trusted server certificate
10-24 12:28:25.089: ERROR/TwitterService#login(3167): at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:360)
10-24 12:28:25.089: ERROR/TwitterService#login(3167): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.getSecureSocket(HttpConnection.java:168)
10-24 12:28:25.089: ERROR/TwitterService#login(3167): at org.apache.harmony.luni.internal.net.www.protocol.https.HttpsURLConnection$HttpsEngine.connect(HttpsURLConnection.java:398)
10-24 12:28:25.089: ERROR/TwitterService#login(3167): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.sendRequest(HttpURLConnection.java:1224)
10-24 12:28:25.089: ERROR/TwitterService#login(3167): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.doRequestInternal(HttpURLConnection.java:1558)
10-24 12:28:25.089: ERROR/TwitterService#login(3167): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.doRequest(HttpURLConnection.java:1551)
10-24 12:28:25.089: ERROR/TwitterService#login(3167): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1145)
10-24 12:28:25.089: ERROR/TwitterService#login(3167): at org.apache.harmony.luni.internal.net.www.protocol.https.HttpsURLConnection.getOutputStream(HttpsURLConnection.java:262)
10-24 12:28:25.089: ERROR/TwitterService#login(3167): at twitter4j.internal.http.HttpClientImpl.request(HttpClientImpl.java:280)
10-24 12:28:25.089: ERROR/TwitterService#login(3167): ... 8 more
10-24 12:28:25.089: ERROR/TwitterService#login(3167): Caused by: java.security.cert.CertificateException: java.security.cert.CertPathValidatorException: TrustAnchor for CertPath not found.
10-24 12:28:25.089: ERROR/TwitterService#login(3167): at org.apache.harmony.xnet.provider.jsse.TrustManagerImpl.checkServerTrusted(TrustManagerImpl.java:168)
10-24 12:28:25.089: ERROR/TwitterService#login(3167): at org.apache.harmony.xnet.provider.jsse.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:355)
10-24 12:28:25.089: ERROR/TwitterService#login(3167): ... 16 more
10-24 12:28:25.089: ERROR/TwitterService#login(3167): Caused by: java.security.cert.CertPathValidatorException: TrustAnchor for CertPath not found.
10-24 12:28:25.089: ERROR/TwitterService#login(3167): at org.bouncycastle.jce.provider.PKIXCertPathValidatorSpi.engineValidate(PKIXCertPathValidatorSpi.java:149)
10-24 12:28:25.089: ERROR/TwitterService#login(3167): at java.security.cert.CertPathValidator.validate(CertPathValidator.java:211)
10-24 12:28:25.089: ERROR/TwitterService#login(3167): at org.apache.harmony.xnet.provider.jsse.TrustManagerImpl.checkServerTrusted(TrustManagerImpl.java:164)
10-24 12:28:25.089: ERROR/TwitterService#login(3167): ... 17 more
确保设备的时间/日期设置正确。
Make sure the device's time / date is set correctly.