TWITTER4J illegalstate - pair already set


#1

I registered my application r/w and see CONSUMER KEY + SECRET. I’m
attempting to get ACCESS TOKEN for another user to this application
(not the user I used to create the application)

http://twitter4j.org/en/code-examples.html #7 DOESN’T WORK for me…

If I use it w/o modification when I get to:
twitter.setOAuthConsumer("[consumer key]", “[consumer secret]”);
it ERRORS:
java.lang.IllegalStateException: consumer key/secret pair already set.

WHICH I haven’t done anything to set state here or previously logged
in (also my IE and FF browsers aren’t logged in)… and there is not
twitter4j.properties file in my directory or path…

if I use ConfigurationBuilder to build the Access Tokens, like:

ConfigurationBuilder cb = new ConfigurationBuilder();
cb.setDebugEnabled(true).setOAuthConsumerKey(consumer_key).setOAuthConsumerSecret(consumer_secret);
if (access_token != null && access_secret != null) {
cb.setOAuthAccessToken(access_token);
cb.setOAuthAccessTokenSecret(access_secret);
}
//cb.setRestBaseURL(url);
TwitterFactory tf = new TwitterFactory(cb.build());
Twitter twitter = tf.getInstance();

I get past the problem, however - I then get problem on LINE
RequestToken requestToken = twitter.getOAuthRequestToken();

IllegalStateException: Access token already available.

After looking extensively on internet, I can’t find a solution for
this…

Any ideas?

Thanks!
Joel


#2

I assume that you’re already specifying the consumer key/secret in twitter4j.properties.
And you cannot overwrite consumer key/secret of a particular Twitter instance.


#3

i have same issue ?


#4

i have same issue


#5

i m facing with same issue


#6

can anyone post solution ??