Android Twitter4j getOAuthAccessToken exception



I’m having strange behavior when trying to login to Twitter with my application.

If i’m logging for a first time I had to enter Login Password and then press “Sign In” button. In this scenario I have exception during call getOAuthAccessToken(requestToken, verifier) function.

Then I’m trying to login for a second and all futher times. This time on twitter login page I’m logged in (no password and login editors) and I have to only press “Sign In” button. In this scenario everything is going ok. Function getOAuthAccessToken returns me an accesToken.

The same code works first and second time, but have diffrent behaviors. This is very strange.


  1. can it be not my fault?
  2. how to fix it if it is my fault?
  3. is there a way to debug twitter4j lib conversation with twitter API?

Finaly my code:
first. I get requestToken and start browser intent

ConfigurationBuilder builder = new ConfigurationBuilder();
Configuration configuration =;

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

second. I receive notification from browser intent

Uri uri = getIntent().getData();
if (uri.toString().startsWith(TWITTER_CALLBACK_URL)) {
String verifier = uri.getQueryParameter(URL_TWITTER_OAUTH_VERIFIER);
try {
AccessToken accessToken = twitter.getOAuthAccessToken(requestToken, verifier);
} catch()

there I have an exception if i was not logged in.

“No authentication challenges found
Relevant discussions can be found on the Internet at: or
TwitterException{exceptionCode=[9ddbeb3a-937eec8d c8a7b39b-dc5ea0d9], statusCode=-1, message=null, code=-1, retryAfter=-1, rateLimitStatus=null, version=3.0.5}”

Link to full sample app code: