本文介绍了Twitter4j 401身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是code,是造成这个问题。以下是logcat的。我已打印除外。我检查了消费者和密钥多次。任何人都可以摆脱了光线或如何获取有关此问题的详细信息?

我还要提到的是我已经运行在模拟器和真正的手机这个剧本,无论带回相同的logcat

  09-21 15:27:25.504:ERROR /的HelloWorld(17680):401:身份验证凭据(https://dev.twitter.com/docs/auth)失踪或不正确。请确保您已设置有效的conumer键/秘密访问令牌/秘密,并在同步系统时钟。
09-21 15:27:25.504:ERROR /的HelloWorld(17680):无法验证的OAuth签名和令牌
09-21 15:27:25.504:ERROR /的HelloWorld(17680):相关讨论可以在Internet上:
09-21 15:27:25.504:ERROR /的HelloWorld(17680):http://www.google.co.jp/search?q=10f5ada3或
09-21 15:27:25.504:ERROR /的HelloWorld(17680):http://www.google.co.jp/search?q=dceba039
09-21 15:27:25.504:ERROR /的HelloWorld(17680):TwitterException {异常code = [10f5ada3-dceba039],状态code = 401,retryAfter = -1,rateLimitStatus = NULL,featureSpecificRateLimitStatus = NULL ,版本2.2.4 =}
09-21 15:27:25.504:ERROR /的HelloWorld(17680):在twitter4j.internal.http.HttpClientImpl.request(HttpClientImpl.java:185)
09-21 15:27:25.504:ERROR /的HelloWorld(17680):在twitter4j.internal.http.HttpClientWrapper.request(HttpClientWrapper.java:65)
09-21 15:27:25.504:ERROR /的HelloWorld(17680):在twitter4j.internal.http.HttpClientWrapper.post(HttpClientWrapper.java:102)
09-21 15:27:25.504:ERROR /的HelloWorld(17680):在twitter4j.auth.OAuthAuthorization.getOAuthRequestToken(OAuthAuthorization.java:121)
09-21 15:27:25.504:ERROR /的HelloWorld(17680):在twitter4j.auth.OAuthAuthorization.getOAuthRequestToken(OAuthAuthorization.java:104)
09-21 15:27:25.504:ERROR /的HelloWorld(17680):在twitter4j.TwitterBaseImpl.getOAuthRequestToken(TwitterBaseImpl.java:276)
09-21 15:27:25.504:ERROR /的HelloWorld(17680):在com.blundell.tut.ttt.TweetToTwitterActivity.loginNewUser(TweetToTwitterActivity.java:109)
09-21 15:27:25.504:ERROR /的HelloWorld(17680):在com.blundell.tut.ttt.TweetToTwitterActivity.buttonLogin(TweetToTwitterActivity.java:83)
09-21 15:27:25.504:ERROR /的HelloWorld(17680):在java.lang.reflect.Method.invokeNative(本机方法)
09-21 15:27:25.504:ERROR /的HelloWorld(17680):在java.lang.reflect.Method.invoke(Method.java:521)
09-21 15:27:25.504:ERROR /的HelloWorld(17680):在android.view.View $ 1.onClick(View.java:2077)
09-21 15:27:25.504:ERROR /的HelloWorld(17680):在android.view.View.performClick(View.java:2461)
09-21 15:27:25.504:ERROR /的HelloWorld(17680):在android.view.View $ PerformClick.run(View.java:8890)
09-21 15:27:25.504:ERROR /的HelloWorld(17680):在android.os.Handler.handleCallback(Handler.java:587)
09-21 15:27:25.504:ERROR /的HelloWorld(17680):在android.os.Handler.dispatchMessage(Handler.java:92)
09-21 15:27:25.504:ERROR /的HelloWorld(17680):在android.os.Looper.loop(Looper.java:123)
09-21 15:27:25.504:ERROR /的HelloWorld(17680):在android.app.ActivityThread.main(ActivityThread.java:4627)
09-21 15:27:25.504:ERROR /的HelloWorld(17680):在java.lang.reflect.Method.invokeNative(本机方法)
09-21 15:27:25.504:ERROR /的HelloWorld(17680):在java.lang.reflect.Method.invoke(Method.java:521)
09-21 15:27:25.504:ERROR /的HelloWorld(17680):在com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:871)
09-21 15:27:25.504:ERROR /的HelloWorld(17680):在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:629)
09-21 15:27:25.504:ERROR /的HelloWorld(17680):在dalvik.system.NativeStart.main(本机方法)


解决方案

  09-21 15:27:25.504:ERROR /的HelloWorld(17680):401:身份验证凭据(HTTPS:/ /dev.twitter.com/docs/auth)的缺失或不正确。请确保您已设置有效的使用者密钥/秘密访问令牌/秘密

您已经输入错误的消费键秘密键从微博的创建的应用程序。

请确保你给这两个按键也保证了它是正确的。

有关此进一步参考检查与Android集成 Twitter的

This is the code that is causing the problem. And below is the Logcat. I have printed the exception. I have checked the consumer and secret keys multiple times. Could anyone shed anymore light or how to get more details on this issue?

I should also mention that I have run this script on the emulator and a real phone, both bring back the same logcat

09-21 15:27:25.504: ERROR/HelloWorld(17680): 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.
09-21 15:27:25.504: ERROR/HelloWorld(17680): Failed to validate oauth signature and token
09-21 15:27:25.504: ERROR/HelloWorld(17680): Relevant discussions can be on the Internet at:
09-21 15:27:25.504: ERROR/HelloWorld(17680):     http://www.google.co.jp/search?q=10f5ada3 or
09-21 15:27:25.504: ERROR/HelloWorld(17680):     http://www.google.co.jp/search?q=dceba039
09-21 15:27:25.504: ERROR/HelloWorld(17680): TwitterException{exceptionCode=[10f5ada3-dceba039], statusCode=401, retryAfter=-1, rateLimitStatus=null, featureSpecificRateLimitStatus=null, version=2.2.4}
09-21 15:27:25.504: ERROR/HelloWorld(17680):     at twitter4j.internal.http.HttpClientImpl.request(HttpClientImpl.java:185)
09-21 15:27:25.504: ERROR/HelloWorld(17680):     at twitter4j.internal.http.HttpClientWrapper.request(HttpClientWrapper.java:65)
09-21 15:27:25.504: ERROR/HelloWorld(17680):     at twitter4j.internal.http.HttpClientWrapper.post(HttpClientWrapper.java:102)
09-21 15:27:25.504: ERROR/HelloWorld(17680):     at twitter4j.auth.OAuthAuthorization.getOAuthRequestToken(OAuthAuthorization.java:121)
09-21 15:27:25.504: ERROR/HelloWorld(17680):     at twitter4j.auth.OAuthAuthorization.getOAuthRequestToken(OAuthAuthorization.java:104)
09-21 15:27:25.504: ERROR/HelloWorld(17680):     at twitter4j.TwitterBaseImpl.getOAuthRequestToken(TwitterBaseImpl.java:276)
09-21 15:27:25.504: ERROR/HelloWorld(17680):     at com.blundell.tut.ttt.TweetToTwitterActivity.loginNewUser(TweetToTwitterActivity.java:109)
09-21 15:27:25.504: ERROR/HelloWorld(17680):     at com.blundell.tut.ttt.TweetToTwitterActivity.buttonLogin(TweetToTwitterActivity.java:83)
09-21 15:27:25.504: ERROR/HelloWorld(17680):     at java.lang.reflect.Method.invokeNative(Native Method)
09-21 15:27:25.504: ERROR/HelloWorld(17680):     at java.lang.reflect.Method.invoke(Method.java:521)
09-21 15:27:25.504: ERROR/HelloWorld(17680):     at android.view.View$1.onClick(View.java:2077)
09-21 15:27:25.504: ERROR/HelloWorld(17680):     at android.view.View.performClick(View.java:2461)
09-21 15:27:25.504: ERROR/HelloWorld(17680):     at android.view.View$PerformClick.run(View.java:8890)
09-21 15:27:25.504: ERROR/HelloWorld(17680):     at android.os.Handler.handleCallback(Handler.java:587)
09-21 15:27:25.504: ERROR/HelloWorld(17680):     at android.os.Handler.dispatchMessage(Handler.java:92)
09-21 15:27:25.504: ERROR/HelloWorld(17680):     at android.os.Looper.loop(Looper.java:123)
09-21 15:27:25.504: ERROR/HelloWorld(17680):     at android.app.ActivityThread.main(ActivityThread.java:4627)
09-21 15:27:25.504: ERROR/HelloWorld(17680):     at java.lang.reflect.Method.invokeNative(Native Method)
09-21 15:27:25.504: ERROR/HelloWorld(17680):     at java.lang.reflect.Method.invoke(Method.java:521)
09-21 15:27:25.504: ERROR/HelloWorld(17680):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:871)
09-21 15:27:25.504: ERROR/HelloWorld(17680):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:629)
09-21 15:27:25.504: ERROR/HelloWorld(17680):     at dalvik.system.NativeStart.main(Native Method)
解决方案
09-21 15:27:25.504: ERROR/HelloWorld(17680): 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

You have entered wrong Consumer Key or Secret Key from your Created Application in Twitter.

Ensure that you gave the two keys also ensure that it is correct.

For Further Reference Check this Integrating Twitter with Android

这篇关于Twitter4j 401身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-12 22:09