EzDevInfo.com

twitter_oauth

Twitter OAuth REST API client library for Ruby

Packaging Blackberry OAuth app throwing error

I am creating an application that will post a link onto Twitter. The following code refuses to package up for me, throwing the following error:

Error: Cannot run program "jar": CreateProcess error=2, The system cannot find the file specified

Here is the code:

public class ShowAuthBrowser extends MainScreen implements OAuthDialogListener
{
    private final String CONSUMER_KEY = "<Consumer>";   
    private final String CONSUMER_SECRET = "<Secret>";
    private LabelField _labelStutus;
    private OAuthDialogWrapper pageWrapper = null;
    public StoreToken _tokenValue;
    public BrowserField b = new BrowserField();
    Manager _authManager;
    Manager _pinManager;
    ButtonField authButton;
    TextField authPin;

    public ShowAuthBrowser()    
    {   
        _authManager = new VerticalFieldManager(NO_VERTICAL_SCROLL |
                                                NO_VERTICAL_SCROLLBAR);
        _pinManager = new HorizontalFieldManager(NO_VERTICAL_SCROLL |
                                                 NO_VERTICAL_SCROLLBAR);
        authButton = new ButtonField("OK");
        authPin = new TextField(Field.EDITABLE);
        _authManager.add(_labelStutus );
        _authManager.add(b);

        _pinManager.add(authButton);
        _pinManager.add(authPin);


        pageWrapper = new BrowserFieldOAuthDialogWrapper(b,CONSUMER_KEY,
                            CONSUMER_SECRET,null,this);
        pageWrapper.setOAuthListener(this);     

        add(_pinManager);
        add(_authManager);

        authButton.setChangeListener( new FieldChangeListener( ) {
            public void fieldChanged( Field field, int context ) {
                if( field == authButton ) {
                       doAuth(authPin.getText());
                }
            }
        } );

    }

    public void doAuth( String pin )
    {
        try
        {
            if ( pin == null )
            {
                pageWrapper.login();
            }
            else
            {
                this.deleteAll();
                add(b);
                pageWrapper.login( pin );
            } 

        }
        catch ( Exception e )
        {
            final String message = "Error logging into Twitter: " + 
                                                e.getMessage();
            Dialog.alert( message );
        }           
    }

    public void onAccessDenied(String response ) {

        updateScreenLog( "Access denied! -> " + response );

    }

    public void onAuthorize(final Token token) {

        final Token myToken = token;
        _tokenValue = StoreToken.fetch();
        _tokenValue.token = myToken.getToken();
        _tokenValue.secret = myToken.getSecret();
        _tokenValue.userId = myToken.getUserId();
        _tokenValue.username = myToken.getUsername();
        _tokenValue.save();

        UiApplication.getUiApplication().invokeLater( new Runnable() {

            public void run() {
                deleteAll();
                Credential c = new Credential(CONSUMER_KEY, 
                                              CONSUMER_SECRET, 
                                              myToken);
                PostTweet tw = new PostTweet();
                String message="Testing BB App";
                boolean done=false;
                done=tw.doTweet(message, c);
                if(done == true)
                {
                    Dialog.alert( "Tweet succusfully..." );
                    close();    
                }
            }
        });

    }

    public void onFail(String arg0, String arg1) {
        updateScreenLog("Error authenticating user! -> " + arg0 + ", " + arg1);
    }

    private void updateScreenLog( final String message )
    {
        UiApplication.getUiApplication().invokeLater( new Runnable() {

            public void run() {
                _labelStutus.setText( message );                
            }
        });
    }
}

The odd thing is, if I remove the following lines, it packages just fine:

authButton.setChangeListener( new FieldChangeListener( ) {
        public void fieldChanged( Field field, int context ) {
            if( field == authButton ) {
                   doAuth(authPin.getText());
            }
        }
    } );

Any help would be appreciated as I really need the field listener attached to this screen.

With code like authButton.setChangeListener(null), it does package successfully however I do need code with FieldChangeListener to do something.


Source: (StackOverflow)

Proxying OAuth Requests to Twitter API

I've been playing with the twitter API for an iPhone test application, and I've missed the ability to proxy the requests I did to the twitter API with a software like Charles (http://www.charlesproxy.com/). Even though it has a SSL Proxying feature, twitter seems to not like the fact that there's a different certificate in the middle signing the requests. Is there any way to do this? I'd be very useful to be able to see the requests and the way Charles formats the JSON responses, etc...


Source: (StackOverflow)

Advertisements

Twitter API - Reasons for "invalid or expired token"

What are the possible reasons that can cause token to get expired (besides having the user un-authorising the app)?

My problem is that i have an app with several thousnds of users, all API communication works perfectly but for some users im getting the "invalid or expired token" error, my initial though was that they are users who canceled the authentication to the app but i've contacted some of them and they havent revoked the access.

any ideas what other issues can cause that error?


Source: (StackOverflow)

Twitter Authentication through Android's AccountManager classes

I am working on a twitter based app and am trying to incorporate Android's built-in Account support for Twitter. The following code works to popup the confirmation dialog for my app to access twitter but I am unsure of what to pass in as the authenticationType. Any help would be appreciated. I've googled all over the place and can't seem to find the correct answer. It goes in place of "oauth" below.

AccountManager am = AccountManager.get(this);
Account[] accts = am.getAccountsByType(TWITTER_ACCOUNT_TYPE);
if(accts.length > 0) {
    Account acct = accts[0];
    am.getAuthToken(acct, "oauth"/*what goes here*/, null, this, new AccountManagerCallback<Bundle>() {

    @Override
    public void run(AccountManagerFuture<Bundle> arg0) {
        try {
                     Bundle b = arg0.getResult();  
                     Log.e("TrendDroid", "THIS AUTHTOKEN: " + b.getString(AccountManager.KEY_AUTHTOKEN));  
                } catch (Exception e) {  
                     Log.e("TrendDroid", "EXCEPTION@AUTHTOKEN");  
                }  
    }}, null);
}

Source: (StackOverflow)

Setting up Twitter API, getting the last few Tweets

I am completely new to using Twitter in general and have never embedded "latest tweets" on any project. I am simply trying to embed the 3-4 newest tweets on the site footer with no additional features of functionality. I have been researching how to do this for quite some time now and having some trouble.

I added the following code snippet to the project, which works quite well, however, I am not sure how to update the snippet so it uses my Twitter account instead of the one it is set up with.

    <div id="twitter_update_list">
    </div>
    <script type="text/javascript" src="http://api.twitter.com/1/statuses/user_timeline.json?screen_name=stackoverflow&include_rts=true&count=4&callback=twitterCallback2">
    </script>

In addition, I keep reading that the most commonly used Twitter API will stop working soon because Twitter wants people to use their own, as opposed to third party.

I am not sure how to proceed from here. I would greatly appreciate any suggestions in this regard. To recap, all I am trying to do is grab the 3-4 latest tweets from my account.

many thanks in advance!


Source: (StackOverflow)

Return recent n number of tweets using TweetSharp

I am trying to get recent 200 tweets using TweetSharp but it is returning 12 for some reason.

var service = new TwitterService(
                 _consumerKey,
                 _consumerSecret,
                 tokenClaim,
                 tokenSecret
                 );

IAsyncResult result = service.BeginListTweetsOnUserTimeline(new ListTweetsOnUserTimelineOptions { Count = 200}
IEnumerable<TwitterStatus> tweets = service.EndListTweetsOnUserTimeline(result);

Any ideas why would that be? Thanks

Update

Following How to fetch maximum 800 tweets from ListTweetOnHomeTimeline() method of TweetSharp?

 IAsyncResult result =
            _twitterService.BeginListTweetsOnUserTimeline(new ListTweetsOnUserTimelineOptions { Count = 200 });
        IEnumerable<TwitterStatus> tweets = _twitterService.EndListTweetsOnUserTimeline(result).ToArray();

        var tweet2 = _twitterService.ListTweetsOnUserTimeline(new ListTweetsOnUserTimelineOptions { Count = 200, MaxId = tweets.Last().Id });

        return tweet2;

tweet2 is empty.


Source: (StackOverflow)

Owin Twitter login - the remote certificate is invalid according to the validation procedure

I started getting this error recently when trying to login using twitter- any idea why?

Stack Trace: 


[AuthenticationException: The remote certificate is invalid according to the validation procedure.]
   System.Net.TlsStream.EndWrite(IAsyncResult asyncResult) +230
   System.Net.PooledStream.EndWrite(IAsyncResult asyncResult) +13
   System.Net.ConnectStream.WriteHeadersCallback(IAsyncResult ar) +123

[WebException: The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.]
   System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult) +6432446
   System.Net.Http.HttpClientHandler.GetResponseCallback(IAsyncResult ar) +64

Source: (StackOverflow)

twitter connection failed

In Android,
Twitter connection failed. SSL is required?

My code was working perfectly and it is currently a live application. However, since 2014 it hasn't been working and I've heard that Twitter has applied https or using SSL concept.

help me to solved this issue.

Here is my log.

 03-14 15:00:02.838: D/TwitterApp(697): Error getting access token
03-14 15:00:02.878: W/System.err(697): 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).
03-14 15:00:02.878: W/System.err(697): message - SSL is required
03-14 15:00:02.878: W/System.err(697): code - 92
03-14 15:00:02.878: W/System.err(697): Relevant discussions can be found on the Internet at:
03-14 15:00:02.878: W/System.err(697):  http://www.google.co.jp/search?q=6f0f59ca or
03-14 15:00:02.888: W/System.err(697):  http://www.google.co.jp/search?q=20d0f73f
03-14 15:00:02.888: W/System.err(697): TwitterException{exceptionCode=[6f0f59ca-20d0f73f], statusCode=403, message=SSL is required, code=92, retryAfter=-1, rateLimitStatus=RateLimitStatusJSONImpl{remaining=14, limit=15, resetTimeInSeconds=1394790328, secondsUntilReset=-18874}, version=3.0.3}
03-14 15:00:02.888: W/System.err(697):  at twitter4j.internal.http.HttpClientImpl.request(HttpClientImpl.java:177)
03-14 15:00:02.888: W/System.err(697):  at twitter4j.internal.http.HttpClientWrapper.request(HttpClientWrapper.java:61)
03-14 15:00:02.888: W/System.err(697):  at twitter4j.internal.http.HttpClientWrapper.get(HttpClientWrapper.java:89)
03-14 15:00:02.888: W/System.err(697):  at twitter4j.TwitterBaseImpl.fillInIDAndScreenName(TwitterBaseImpl.java:126)
03-14 15:00:02.888: W/System.err(697):  at twitter4j.TwitterImpl.verifyCredentials(TwitterImpl.java:592)
03-14 15:00:02.908: W/System.err(697):  at com.twitter.android.TwitterApp$3.run(TwitterApp.java:150)

twitter connection code. http://www.androidhive.info/2012/09/android-twitter-oauth-connect-tutorial/ this is a develop


Source: (StackOverflow)

Why is my twitter oauth access token invalid / expired

I am using Twitter to log users into to a website, which seems to be working up until I attempt to obtain a valid Access Token.

require("twitteroauth.php");
require 'twconfig.php';
session_start();

$twitteroauth = new TwitterOAuth(YOUR_CONSUMER_KEY, YOUR_CONSUMER_SECRET);
$request_token = $twitteroauth->getRequestToken('http://****/tw_response.php');

$oauth_token = $request_token['oauth_token'];
$_SESSION['oauth_token'] = $oauth_token;

$oauth_token_secret = $request_token['oauth_token_secret'];
$_SESSION['oauth_token_secret'] = $oauth_token_secret;

if ($twitteroauth->http_code == 200) {
    url = $twitteroauth->getAuthorizeURL($request_token['oauth_token']);
    header('Location: '.$url);
} else {
    die('Something wrong happened.');
}

This seems to be working correctly, redirecting me to twitter to sign in and confirm access, after which it returns me to tw_response.php (my Callback url), with the following variables in the url:

http://example.com/login.php?oauth_token=sO3X...yj0k&oauth_verifier=Ip6T...gALQ 

In tw_response.php I then try to get the Access Token, but it reports as invalid. I tried using var_dump to view the content of the access token as follows:

require("twitteroauth.php");
require 'twconfig.php';
session_start();

$oauth_verifier = $_REQUEST['oauth_verifier'];
$oauth_token = $_SESSION['oauth_token'];
$oauth_token_secret = $_SESSION['oauth_token_secret'];

$twitteroauth = new TwitterOAuth(YOUR_CONSUMER_KEY, YOUR_CONSUMER_SECRET, $oauth_token, $oauth_token_secret);

$access_token = $twitteroauth->getAccessToken($data['oauth_verifier']);
var_dump($access_token);

The result of the var_dump ends in "invalid / expired Token":

array(8) {
    ["oauth_url"] => string(104) ""1.0" encoding="UTF-8"?>/oauth/access_token?oauth_consumer_key=ceE...9Dg"
    ["oauth_nonce"]=> string(32) "c52...d07"
    ["oauth_signature"]=> string(28) "ry7...Fcc="
    ["oauth_signature_method"]=> string(9) "HMAC-SHA1"
    ["oauth_timestamp"]=> string(10) "1359031586"
    ["oauth_token"]=> string(40) "sO3...j0k"
    ["oauth_verifier"]=> string(43) "Ip6...ALQ"
    ["oauth_version"]=> string(63) "1.0 Invalid / expired Token "
}

Source: (StackOverflow)

OAuth callbacks in iPhone web apps

I'm building a full-screen iPhone optimized web app. It gets launched from the homepage like a native app and behaves like a standalone app via the following directive, but it's just plain HTML/CSS/JavaScript, no PhoneGap involved.

<meta name="apple-mobile web-app-capable" content="yes" />

When trying to authenticate over OAuth, the redirect to Twitter (or any other OAuth provider) takes me out of my full-screen web app and into Mobile Safari. Once the Twitter auth completes, the redirect back to my app does not launch my homepage app, instead just redirects within Mobile Safari. Is it possible to do OAuth inside an iPhone homepage web app? Short of that, can I get the OAuth callback to re-launch my homepage web app?


Source: (StackOverflow)

best practice for storing oauth AND local authentication methods?

If I were to run a service that allowed users to authenticate via "local" username/password combinations and ALSO any number of OAuth services - what might that user data model look like?

Usually, if I were handling all logins myself, in the "user" database (assuming MySQL), the username and password fields would be required as non-null. But, if my users just wanted to log in with Facebook, I'd just store the Facebook auto token, and not have any username/password locally.

Further, what if they want to log in with Twitter creds, and then tumblr, and then whatever service-of-the-day? I could keep a field for each type, but that might get a little unwieldy. Would I be better off keeping another table of "authentication methods" for lack of a better term, so I could have a one-to-many relationship between users and how authenticate them?

Basically, I'm asking if anyone knows of an industry standard best practice for this scenario, or can point me in the right direction (or if someone has implemented something like this that works well for them). One user, multiple methods of authenticating - what's the best way to hold that info?

If any of the assumptions I've made are invalid, I apologize, please correct me.


Source: (StackOverflow)

Zend_Service_Twitter - Make API v1.1 ready

The Zend_Service_Twitter component is still for Twitters API v1.0 which will be deprecated at 5th March 2013. So I wanted to make my new website with Twitter API interaction v1.1 ready. Everything works fine with v1.0 but if I change the URL from /1/ to /1.1/ it fails with the HTTP header code 400 and the JSON error message: Bad Authentication data (Code: 215)

To get the request and access token stayed the same and works already without any changes, but if I want to verify the credentials like this I get the error I described above:

// Take a look for the code here: http://framework.zend.com/manual/1.12/en/zend.oauth.introduction.html
$accessToken = $twitterAuth->getAccessToken($_GET, unserialize($_SESSION['TWITTER_REQUEST_TOKEN']));


// I have a valid access token and now the problematic part
$twitter = new Zend_Service_Twitter(array(
    'username' => $accessToken->getParam('screen_name'),
    'accessToken' => $accessToken
));
print_r($twitter->account->verifyCredentials());

I changed the code of verifyCredentials in Zend/Service/Twitter.php from that to that:

public function accountVerifyCredentials()
{
    $this->_init();
    $response = $this->_get('/1/account/verify_credentials.xml');
    return new Zend_Rest_Client_Result($response->getBody());
}

// to

public function accountVerifyCredentials()
{
    $this->_init();
    $response = $this->_get('/1.1/account/verify_credentials.json');
    return Zend_Json::decode($response->getBody());
}

Now I added before the return Zend_Json[...] this line:

print_r($this->_localHttpClient->getLastRequest());

// And I get this output of it:

GET /1.1/account/verify_credentials.json HTTP/1.1
Host: api.twitter.com
Connection: close
Accept-encoding: gzip, deflate
User-Agent: Zend_Http_Client
Accept-Charset: ISO-8859-1,utf-8
Authorization: OAuth realm="",oauth_consumer_key="",oauth_nonce="91b6160db351060cdf4c774c78e2d0f2",oauth_signature_method="HMAC-SHA1",oauth_timestamp="1349107209",oauth_version="1.0",oauth_token="hereismytoken",oauth_signature="hereisavalidsignature"

As you could see the oauth_consumer_key (and realm too) is empty. Could that be the error? How could I solve this error (because of the stricter new API version?)? Would it be fine to set somehow the oauth_consumer_key? If yes, how could I manage that?

Edit: I also found already a bug report on the issue tracker of the Zend Framework: http://framework.zend.com/issues/browse/ZF-12409 (maybe do an upvote?)


Source: (StackOverflow)

OAuth::Unauthorized 401 int twitter-omniauth gem

I have been trying to authenticate users using twitter-omniauth gem for last days, yet not successful. (Authentication with facebook works perfectly)

I'm keep getting 401 Unauthorized error.

I search through stackoverflow, but none of the answers could solve my problem.

I reach the twitter login when I try http://127.0.0.1/users/auth/twitter. I login and I'm redirected to http://127.0.0.1/users/auth/twitter/callback and unauthorized error comes.

Below callback url I have entered in twitter

http://127.0.0.1/users/auth/twitter/callback

rake routes output

new_user_session GET    /users/sign_in(.:format)               {:action=>"new", :controller=>"devise/sessions"}
                user_session POST   /users/sign_in(.:format)               {:action=>"create", :controller=>"devise/sessions"}
        destroy_user_session DELETE /users/sign_out(.:format)              {:action=>"destroy", :controller=>"devise/sessions"}
      user_omniauth_callback        /users/auth/:action/callback(.:format) {:action=>/twitter|facebook/, :controller=>"users/omniauth_callbacks"}
               user_password POST   /users/password(.:format)              {:action=>"create", :controller=>"devise/passwords"}
           new_user_password GET    /users/password/new(.:format)          {:action=>"new", :controller=>"devise/passwords"}
          edit_user_password GET    /users/password/edit(.:format)         {:action=>"edit", :controller=>"devise/passwords"}
                             PUT    /users/password(.:format)              {:action=>"update", :controller=>"devise/passwords"}
    cancel_user_registration GET    /users/cancel(.:format)                {:action=>"cancel", :controller=>"devise/registrations"}
           user_registration POST   /users(.:format)                       {:action=>"create", :controller=>"devise/registrations"}
       new_user_registration GET    /users/sign_up(.:format)               {:action=>"new", :controller=>"devise/registrations"}
      edit_user_registration GET    /users/edit(.:format)                  {:action=>"edit", :controller=>"devise/registrations"}
                             PUT    /users(.:format)                       {:action=>"update", :controller=>"devise/registrations"}
                             DELETE /users(.:format)                       {:action=>"destroy", :controller=>"devise/registrations"}
                       login        /login(.:format)                       {:action=>"login", :controller=>"home"}
                        root        /                                      {:controller=>"home", :action=>"index"}

If you need anymore info, I'll provide. Please help me to solve this.


Source: (StackOverflow)

How to solve "LibXml/xmlreader.h Not found" error in Twitter integration in iPhone

I want to integrate Twitter in my application. I integrated related files and added libxml2 library. I included the path for it in "Header Search paths" field. When i try to build my application, I am getting errors showing that LibXml/xmlreader.h: No Such file or Directory.

Can anyone please help me in this. Thanks in Advance.


Source: (StackOverflow)

Why the method getOAuthAccessToken always fire the exception in the twitter4j api?

I'm following a lot of instructions to make a simple tweet from my app. I've already registered it on Twitter, but I just can't make a tweet. I can login, but not update my status. Here's the code to login

private void twitterLogOn() {
        Twitter twitter = new TwitterFactory().getInstance();
        try {

            twitter.setOAuthConsumer(consumerKey, consumerSecret);
            rToken = twitter.getOAuthRequestToken(myCallBack);
            startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(rToken.getAuthenticationURL())));
        } catch (IllegalStateException e) {
            // access token is already available, or consumer key/secret is not
            // set.
            if (!twitter.getAuthorization().isEnabled()) {
                System.out.println("OAuth consumer key/secret is not set.");
                finish();
            }
        } catch (Exception e) {
            Toast.makeText(Configuration.this,getString(R.string.networkError), Toast.LENGTH_SHORT).show();
        }
    }

That seems to work fine, but when I go back to my app after the login, this next code should be executed, ending always in the exception Toast.

public void onResume() {    
        super.onResume();

        Uri uri = getIntent().getData();

        if (uri != null) {    
            oauthVerifier = uri.getQueryParameter("oauth_verifier");

            try {    
                Twitter tt = new TwitterFactory().getInstance(); // Do I need this new twitter instance?
                tt.setOAuthConsumer(consumerKey, consumerSecret);
                AccessToken at = tt.getOAuthAccessToken(rToken, oauthVerifier); // Gives the error

                       // Do tweet here ...

                } catch (Exception e) {
                    Toast.makeText(Configuration.this, "Network Host not responding",Toast.LENGTH_SHORT).show();
                }
            }
    }

Any good hawk eye there that can tell me what I'm doing wrong? This is the line firing the exception

AccessToken at = tt.getOAuthAccessToken(rToken, oauthVerifier);

Thanks in advance!

EDIT

Stack Trace: (read somewhere this is just hiding a 401 error)

07-24 12:49:31.931: WARN/System.err(18441): Received authentication challenge is nullRelevant discussions can be on the Internet at:
07-24 12:49:31.931: WARN/System.err(18441):     http://www.google.co.jp/search?q=9ddbeb3a or
07-24 12:49:31.931: WARN/System.err(18441):     http://www.google.co.jp/search?q=5c9c15a6
07-24 12:49:31.931: WARN/System.err(18441): TwitterException{exceptionCode=[9ddbeb3a-5c9c15a6 c8a7b39b-36e69ae1], statusCode=-1, retryAfter=-1, rateLimitStatus=null, featureSpecificRateLimitStatus=null, version=2.2.3}
07-24 12:49:31.931: WARN/System.err(18441):     at twitter4j.internal.http.HttpClientImpl.request(HttpClientImpl.java:204)
07-24 12:49:31.931: WARN/System.err(18441):     at twitter4j.internal.http.HttpClientWrapper.request(HttpClientWrapper.java:65)
07-24 12:49:31.931: WARN/System.err(18441):     at twitter4j.internal.http.HttpClientWrapper.post(HttpClientWrapper.java:102)
07-24 12:49:31.931: WARN/System.err(18441):     at twitter4j.auth.OAuthAuthorization.getOAuthAccessToken(OAuthAuthorization.java:142)
07-24 12:49:31.931: WARN/System.err(18441):     at twitter4j.auth.OAuthAuthorization.getOAuthAccessToken(OAuthAuthorization.java:160)
07-24 12:49:31.931: WARN/System.err(18441):     at twitter4j.TwitterBaseImpl.getOAuthAccessToken(TwitterBaseImpl.java:349)
07-24 12:49:31.931: WARN/System.err(18441):     at com.my.app.TwitterTweetActivity.onResume(TwitterTweetActivity.java:76)
07-24 12:49:31.931: WARN/System.err(18441):     at com.my.app.TwitterTweetActivity.onResume(TwitterTweetActivity.java:64)
07-24 12:49:31.931: WARN/System.err(18441):     at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1149)
07-24 12:49:31.931: WARN/System.err(18441):     at android.app.Activity.performResume(Activity.java:3833)
07-24 12:49:31.931: WARN/System.err(18441):     at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2215)
07-24 12:49:31.941: WARN/System.err(18441):     at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2240)
07-24 12:49:31.941: WARN/System.err(18441):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1773)
07-24 12:49:31.941: WARN/System.err(18441):     at android.app.ActivityThread.access$1500(ActivityThread.java:123)
07-24 12:49:31.941: WARN/System.err(18441):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:936)
07-24 12:49:31.941: WARN/System.err(18441):     at android.os.Handler.dispatchMessage(Handler.java:99)
07-24 12:49:31.941: WARN/System.err(18441):     at android.os.Looper.loop(Looper.java:123)
07-24 12:49:31.941: WARN/System.err(18441):     at android.app.ActivityThread.main(ActivityThread.java:3812)
07-24 12:49:31.941: WARN/System.err(18441):     at java.lang.reflect.Method.invokeNative(Native Method)
07-24 12:49:31.941: WARN/System.err(18441):     at java.lang.reflect.Method.invoke(Method.java:507)
07-24 12:49:31.941: WARN/System.err(18441):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
07-24 12:49:31.941: WARN/System.err(18441):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
07-24 12:49:31.941: WARN/System.err(18441):     at dalvik.system.NativeStart.main(Native Method)
07-24 12:49:31.941: WARN/System.err(18441): Caused by: java.io.IOException: Received authentication challenge is null
07-24 12:49:31.941: WARN/System.err(18441):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.processAuthHeader(HttpURLConnectionImpl.java:1153)
07-24 12:49:31.941: WARN/System.err(18441):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.processResponseHeaders(HttpURLConnectionImpl.java:1095)
07-24 12:49:31.951: WARN/System.err(18441):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.retrieveResponse(HttpURLConnectionImpl.java:1048)
07-24 12:49:31.951: WARN/System.err(18441):     at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:726)
07-24 12:49:31.951: WARN/System.err(18441):     at twitter4j.internal.http.HttpResponseImpl.<init>(HttpResponseImpl.java:35)
07-24 12:49:31.951: WARN/System.err(18441):     at twitter4j.internal.http.HttpClientImpl.request(HttpClientImpl.java:168)
07-24 12:49:31.951: WARN/System.err(18441):     ... 22 more

API for the method: getOAuthREquestToken


Source: (StackOverflow)