2014-06-21 32 views
0

在我的Android應用程序中,我需要添加twitter登錄功能.i已在應用程序中集成了代碼,但在返回異常ssl中未找到。 我的登錄代碼 -安卓應用程序中的Twitter集成錯誤

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

相關討論可以在互聯網上找到:

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,版本2.2.6 =}

SSL is required 

ExceptionDiagnosis {stackLineHash = 284536227,lineNumberHash = -588537799}

我沒有得到的錯誤是什麼。

還有一個問題是app中使用了什麼回調url。

在此先感謝。

回答

0

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

twitter4j 4.x默認使用ssl。 Twitter現在需要所有連接使用「https://」而不是「http://」

0

當我使用Twitter4j版本3.0.3時,我遇到了類似的問題,但是當我使用最新的 - 4.0 .2 - 它工作得很好。

相關問題