0
votes

In my android app i need to add twitter login functionality.i have integrated code in app but in returns exception ssl is not found. My code for login is -

 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();
    }

and it returns error is -

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 is required

Relevant discussions can be found on the Internet at:

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

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

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

null

 SSL is required

null

ExceptionDiagnosis{stackLineHash=284536227, lineNumberHash=-588537799}

i am not getting what the error is.

one more question is what callback url is used in app.

Thanks in advance.

2

2 Answers

0
votes

Update your twitter4j jar to the latest version.

twitter4j 4.x use ssl by default. Twitter now needs all the connections to use "https://" instead of "http://"

0
votes

I had similar problem when I was working with Twitter4j version 3.0.3, but when I used the latest one - 4.0.2 - It worked perfectly fine.