sattu
sattu

Reputation: 650

How to set consumer key/secret pair in Twitter4J?

ConfigurationBuilder cb = new ConfigurationBuilder();
        cb.setDebugEnabled(true)
          .setOAuthConsumerKey("*********************")
          .setOAuthConsumerSecret("******************************************")
          .setOAuthAccessToken("**************************************************")
          .setOAuthAccessTokenSecret("******************************************");
        TwitterFactory tf = new TwitterFactory(cb.build());
        Twitter twitter = tf.getInstance();

What are the values in place of *?

Upvotes: 2

Views: 3321

Answers (1)

Anon Gordon
Anon Gordon

Reputation: 2539

The Consumer Key and Consumer Secret are provided when you create your application at https://dev.twitter.com/apps. There is more information in this question. You then have to get the access token from your users.

The Twitter developer documentation has a description of the whole process, but it can be hard to know where to start. I suggest you look for guide like this one. (Understanding how OAuth works will make the whole process clearer.)

Upvotes: 2

Related Questions