Tutorial :Android Jtwitter forgidden exception


Android I am using jTwitter

  1. Twitter my_twiter = new Twitter("my_user_name","my_pass");
  2. my_twiter.setStatus("hello world");

line 2 throws

winterwell.jtwitter.TwitterException$E403: Forbidden http://twitter.com/statuses/update.json (my_user_name)

what does that mean ??


403 Forbidden: 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.

Statuses over 140 characters will also cause a 403. But since you are just doing "hello world" that shouldn't be the case. The response body will contain a detailed error message.


One reason Twitter will return a 403 error is if you repeatedly post the same status message. That's probably what you've encountered here.

Try adding a random number to your test code, e.g.

my_twiter.setStatus("hello world "+new Random().nextInt(1000));  

By the way, I see you're using the username/password login method. Twitter have announced they're switching that off - I think at the end of August. You may want to switch to OAuth. See the JTwitter homepage for details: http://www.winterwell.com/software/jtwitter.php

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »