Search code examples
javatwitteroauthtwitter4j

Twitter4J Access token already available


I am receiving error messages while working with Twitter4J:

java.lang.IllegalStateException: Access token already available.
twitter4j.auth.OAuthAuthorization.getOAuthRequestToken(OAuthAuthorization.java:112)
twitter4j.auth.OAuthAuthorization.getOAuthRequestToken(OAuthAuthorization.java:104)
twitter4j.TwitterBaseImpl.getOAuthRequestToken(TwitterBaseImpl.java:276)
twitter4j.TwitterBaseImpl.getOAuthRequestToken(TwitterBaseImpl.java:269)
[...]

This exception is thrown while calling the method Twitter.getOAuthRequestToken(). I want to get the Authorization URL to authenticate the next user.

How am I possible to solve this problem? I only put the OAuthConsumerKey, the OAuthConsumerSecret, the OAuthAccessToken and the OAuthAccessTokenSecret to the Twitter4J properties. But how do I receive the authorization URL to authenticate a new user?

Thanks and greetings,

Martin


Solution

  • Sorry.

    I was setting an Access Token hard coded by the Configuration Builder.

    Removed it, works now.