Question

I am getting the following authertication error when I post on my app.

10-07 15:36:54.265: E/AndroidRuntime(2537): FATAL EXCEPTION: Thread-199
10-07 15:36:54.265: E/AndroidRuntime(2537): winterwell.jtwitter.TwitterException$E401: code 215: Bad Authentication data
10-07 15:36:54.265: E/AndroidRuntime(2537):     at winterwell.jtwitter.URLConnectionHttpClient.processError(URLConnectionHttpClient.java:483)
10-07 15:36:54.265: E/AndroidRuntime(2537):     at winterwell.jtwitter.URLConnectionHttpClient.post2_connect(URLConnectionHttpClient.java:413)
10-07 15:36:54.265: E/AndroidRuntime(2537):     at winterwell.jtwitter.URLConnectionHttpClient.post2(URLConnectionHttpClient.java:379)
10-07 15:36:54.265: E/AndroidRuntime(2537):     at winterwell.jtwitter.URLConnectionHttpClient.post(URLConnectionHttpClient.java:348)
10-07 15:36:54.265: E/AndroidRuntime(2537):     at winterwell.jtwitter.Twitter.updateStatus(Twitter.java:2762)
10-07 15:36:54.265: E/AndroidRuntime(2537):     at winterwell.jtwitter.Twitter.updateStatus(Twitter.java:2694)
10-07 15:36:54.265: E/AndroidRuntime(2537):     at winterwell.jtwitter.Twitter.setStatus(Twitter.java:2482)
10-07 15:36:54.265: E/AndroidRuntime(2537):     at com.example.yamba.StatusActivity$1.run(StatusActivity.java:31)

The credentials provided work , when I try to logon to twitter.com from webbrowser.

My Code:

public void onClick(View v) {
        final String statusText = editStatus.getText().toString();
        new Thread(){
         public void run(){
        Twitter twitter = new Twitter("username", "password");
        twitter.setStatus(statusText);              
         }
      }.start();
    }

Jtwitter version : 2.9.0

Was it helpful?

Solution

I'm afraid you can't use username/password login for the Twitter API. They switched it off a couple of years ago.

You need to use OAuth instead -- there's documentation at the JTwitter webpage, or in the javadoc.

NB: To quote the javadoc: the username/password constructor is "only for non-Twitter sites, such as identi.ca."

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top