Android Twitter login failed with Twiter4j

邮差的信 提交于 2019-12-11 11:28:46

问题


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)

回答1:


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




回答2:


Upgrade your twitter4j jar from twiter4j 3.0.3 to twiter4j 3.0.5 its a new release .




回答3:


See this example may be it is usefull

https://github.com/learnNcode/DemoTwitterImagePost

And This One Also

http://chintankhetiya.wordpress.com/2013/07/18/sharing-text-image-in-twitter-android-example/



来源:https://stackoverflow.com/questions/21276524/android-twitter-login-failed-with-twiter4j

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!