Reputation: 15986
I've used the com.sugree.twitter technique to obtain the twitter access token and the access key. Now. I want to pass these into the twitter4j library. But, I am getting an error on this line as follows:
twitter4j.auth.AccessToken accessToken = new twitter4j.auth.AccessToken(twitter.getAccessToken(),twitter.getSecretToken());
06-21 18:43:08.140: ERROR/AndroidRuntime(1293): java.lang.IllegalStateException: Consumer key and Consumer secret not supplied.
Upvotes: 1
Views: 1482
Reputation: 732
You can specify consumer key/secret in twitter4j.properties. http://twitter4j.org/en/configuration.html
Upvotes: 1
Reputation: 15986
Solution:
ConfigurationBuilder cb = new ConfigurationBuilder();
cb.setDebugEnabled(true)
.setOAuthConsumerKey(twitterKey)
.setOAuthConsumerSecret(twitterSecret)
.setOAuthAccessToken(twitter.getAccessToken())
.setOAuthAccessTokenSecret(twitter.getSecretToken());
TwitterFactory tf = new TwitterFactory(cb.build());
twitter4j.Twitter t4jTwitter = tf.getInstance();
Upvotes: 2