本文介绍了Android的Twitter的登录失败,Twiter4j的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用twiter4j 3.0.3我application.I已经使用以下code用于登录集成Twiiter。这是工作before.Now它抛出一个异常,而试图登录。登录猫附后。

  ConfigurationBuilder建设者=新ConfigurationBuilder();
            builder.setOAuthConsumerKey(Constants.TWITTER_CONSUMER_KEY);
            builder.setOAuthConsumerSecret(Constants.TWITTER_CONSUMER_SECRET);
            配置配置= builder.build();            TwitterFactory厂=新TwitterFactory(配置);
            叽叽喳喳= factory.getInstance();            尝试{
                requestToken = twitter.getOAuthRequestToken();
                isSuccess =真;
            }赶上(TwitterException E){
                isSuccess = FALSE;
                e.printStackTrace();
            }

logcat的

  12月1日至22日:06:27.666:W / System.err的(2581)403:请求被理解,但它已被拒绝。一位随行的错误信息会解释为什么。当请求被拒绝,由于更新的限制这code使用(https://support.twitter.com/articles/15364-about-twitter-limits-update-api-dm-and-following)。
12月1日至22日:06:27.666:W / System.err的(2581):相关讨论可以在互联网上上找到:
12月1日至22日:06:27.666:W / System.err的(2581):http://www.google.co.jp/search?q=bfb606ed或
12月1日至22日:06:27.666:W / System.err的(2581):http://www.google.co.jp/search?q=4ef9707c
12月1日至22日:06:27.666:W / System.err的(2581):TwitterException {异常code = [bfb606ed-4ef9707c],状态code = 403,消息= NULL,code = - 1,retryAfter = -1,rateLimitStatus = NULL,版本= 3.0.3}
12月1日至22日:06:27.666:W / System.err的(2581):在twitter4j.internal.http.HttpClientImpl.request(HttpClientImpl.java:177)
12月1日至22日:06:27.666:W / System.err的(2581):在twitter4j.internal.http.HttpClientWrapper.request(HttpClientWrapper.java:61)
12月1日至22日:06:27.666:W / System.err的(2581):在twitter4j.internal.http.HttpClientWrapper.post(HttpClientWrapper.java:98)
12月1日至22日:06:27.666:W / System.err的(2581):在twitter4j.auth.OAuthAuthorization.getOAuthRequestToken(OAuthAuthorization.java:122)
12月1日至22日:06:27.666:W / System.err的(2581):在twitter4j.auth.OAuthAuthorization.getOAuthRequestToken(OAuthAuthorization.java:104)
12月1日至22日:06:27.666:W / System.err的(2581):在twitter4j.TwitterBaseImpl.getOAuthRequestToken(TwitterBaseImpl.java:281)
12月1日至22日:06:27.666:W / System.err的(2581):在twitter4j.TwitterBaseImpl.getOAuthRequestToken(TwitterBaseImpl.java:273)


解决方案

我们与Twitter连接是具有问题。请更换最新的twitter4j 3.0.5jar旧twitter4j.jar库

链接:

从这里得到它,享受

I am using twiter4j 3.0.3 for integrating Twiiter to my application.I have used following code for login. It was working before.Now it throws an exception while trying to login. Log cat is attached.

ConfigurationBuilder builder = new ConfigurationBuilder();
            builder.setOAuthConsumerKey(Constants.TWITTER_CONSUMER_KEY);
            builder.setOAuthConsumerSecret(Constants.TWITTER_CONSUMER_SECRET);
            Configuration configuration = builder.build();

            TwitterFactory factory = new TwitterFactory(configuration);
            twitter = factory.getInstance();

            try {
                requestToken = twitter.getOAuthRequestToken();
                isSuccess = true;
            } catch (TwitterException e) {
                isSuccess = false;
                e.printStackTrace();
            }

Logcat

 01-22 12:06:27.666: W/System.err(2581): 403:The request is understood, but it has been refused. An accompanying error message will explain why. This code is used when requests are being denied due to update limits (https://support.twitter.com/articles/15364-about-twitter-limits-update-api-dm-and-following).
01-22 12:06:27.666: W/System.err(2581): Relevant discussions can be found on the Internet at:
01-22 12:06:27.666: W/System.err(2581):     http://www.google.co.jp/search?q=bfb606ed or
01-22 12:06:27.666: W/System.err(2581):     http://www.google.co.jp/search?q=4ef9707c
01-22 12:06:27.666: W/System.err(2581): TwitterException{exceptionCode=[bfb606ed-4ef9707c], statusCode=403, message=null, code=-1, retryAfter=-1, rateLimitStatus=null, version=3.0.3}
01-22 12:06:27.666: W/System.err(2581):     at twitter4j.internal.http.HttpClientImpl.request(HttpClientImpl.java:177)
01-22 12:06:27.666: W/System.err(2581):     at twitter4j.internal.http.HttpClientWrapper.request(HttpClientWrapper.java:61)
01-22 12:06:27.666: W/System.err(2581):     at twitter4j.internal.http.HttpClientWrapper.post(HttpClientWrapper.java:98)
01-22 12:06:27.666: W/System.err(2581):     at twitter4j.auth.OAuthAuthorization.getOAuthRequestToken(OAuthAuthorization.java:122)
01-22 12:06:27.666: W/System.err(2581):     at twitter4j.auth.OAuthAuthorization.getOAuthRequestToken(OAuthAuthorization.java:104)
01-22 12:06:27.666: W/System.err(2581):     at twitter4j.TwitterBaseImpl.getOAuthRequestToken(TwitterBaseImpl.java:281)
01-22 12:06:27.666: W/System.err(2581):     at twitter4j.TwitterBaseImpl.getOAuthRequestToken(TwitterBaseImpl.java:273)
解决方案

we were having problem in connecting with twitter. Please replace your old twitter4j.jar library with the latest twitter4j 3.0.5jar

link:

https://www.dropbox.com/s/dt4suej0zkoi997/twitter4j-core-3.0.5.jar

get it from here and enjoy

这篇关于Android的Twitter的登录失败,Twiter4j的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 17:13