繁体   English   中英

Twitter4j 401身份验证

[英]Twitter4j 401 Authentication

这是导致问题的代码。 下面是Logcat。 我已经打印了例外。 我已经多次检查了使用者密钥和秘密密钥。 任何人都可以阐明更多信息,或者如何获得有关此问题的更多详细信息?

我还应该提到我已经在模拟器和真实电话上运行了该脚本,它们都返回了相同的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)

也许您已经创建了一个桌面应用程序。 在浏览器应用程序上更改您的应用程序类型。 这是很好的教程http://www.androidhive.info/2012/09/android-twitter-oauth-connect-tutorial/

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

您在Twitter中创建的应用程序中输入了错误的使用者密钥秘密密钥

确保您提供了两个密钥,也确保它是正确的。

有关更多参考,请参阅将此Twitter与Android集成

查看我的应用程序设置应用程序类型

访问:

  • 只读
  • 读和写
  • 读取,写入和访问直接消息

您的应用程序需要哪种类型的访问权限? 注意: @Anywhere应用程序需要读写访问权限。

详细了解我们的应用程序许可模型

默认为只读,请选择读写。

我的设备日期不正确 看起来很奇怪,但是确实有效。 日期设置正确后,它可以正常工作。 您可能会显示警报,要求用户检查设备的当前日期和/或时间。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM