【问题标题】:Twitter integration error in android appAndroid应用程序中的Twitter集成错误
【发布时间】:2014-08-11 23:44:07
【问题描述】:

在我的 android 应用程序中,我需要添加 twitter 登录功能。我在应用程序中集成了代码,但在返回时找不到异常 ssl。 我的登录代码是 -

 if (!isTwitterLoggedInAlready()) {
        ConfigurationBuilder builder = new ConfigurationBuilder();
        builder.setOAuthConsumerKey(TWITTER_CONSUMER_KEY);
        builder.setOAuthConsumerSecret(TWITTER_CONSUMER_SECRET);
        Configuration configuration = builder.build();

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

        try {
            requestToken = twitter
                    .getOAuthRequestToken(TWITTER_CALLBACK_URL);
            this.startActivity(new Intent(Intent.ACTION_VIEW, Uri
                    .parse(requestToken.getAuthenticationURL())));
        } catch (TwitterException e) {
            e.printStackTrace();
        }
    } else {
        // user already logged into twitter
        Toast.makeText(getApplicationContext(),
                "Already Logged into twitter", Toast.LENGTH_LONG).show();
    }

它返回的错误是 -

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- -following).

需要 SSL

相关讨论可以在 Internet 上找到:

http://www.google.co.jp/search?q=10f5ada3

http://www.google.co.jp/search?q=dceba039

TwitterException{exceptionCode=[10f5ada3 dceba039], statusCode=403, retryAfter=-1, rateLimitStatus=null, featureSpecificRateLimitStatus=null, version=2.2.6}

 SSL is required

异常诊断{stackLineHash=284536227, lineNumberHash=-588537799}

我不知道错误是什么。

还有一个问题是app中使用了什么回调url。

提前致谢。

【问题讨论】:

    标签: android twitter-oauth twitter4j


    【解决方案1】:

    将您的 twitter4j jar 更新到最新版本。

    twitter4j 4.x 默认使用 ssl。 Twitter 现在需要所有连接使用“https://”而不是“http://”

    【讨论】:

      【解决方案2】:

      我在使用 Twitter4j 版本 3.0.3 时遇到了类似的问题,但是当我使用最新版本 - 4.0.2 时 - 它工作得非常好。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-06-29
        • 2011-06-24
        • 1970-01-01
        • 2015-06-14
        • 2011-11-03
        • 1970-01-01
        相关资源
        最近更新 更多