在 Android 应用程序中获取 Twitter 的访问令牌时出错

发布于 12-12 02:29 字数 5397 浏览 0 评论 0原文

在尝试使用 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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

十秒萌定你2024-12-19 02:29:57

确保设备的时间/日期设置正确。

Make sure the device's time / date is set correctly.

昵称有卵用2024-12-19 02:29:57

不,这个问题与日期和时间无关,请检查这里
Android 上接受自签名 SSL

您的网络不允许 Twitter(可能是受限制的)。切换您的网络 b/w wifi 或 Edge 。

No this problem is not related to date and time plz check here
Self-signed SSL acceptance on Android

Twitter is not allowed on your network(It may be restricted). Switch your network b/w wifi or edge .

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文