Advertisement
Guest User

twitter4j authentication

a guest
Oct 26th, 2015
15
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. import twitter4j.Twitter;
  3. import twitter4j.TwitterFactory;
  4. import twitter4j.conf.ConfigurationBuilder;
  5.  
  6. public class Auth {
  7.     Twitter twitter = null;
  8.     public Auth() {
  9.         ConfigurationBuilder cb = new ConfigurationBuilder();
  10.         cb.setDebugEnabled(true)
  11.                 .setOAuthConsumerKey("KEY HERE")
  12.                 .setOAuthConsumerSecret("SECRET HERE")
  13.                 .setOAuthAccessToken("TOKEN HERE")
  14.                 .setOAuthAccessTokenSecret("TOKEN SECRET HERE");
  15.  
  16.         TwitterFactory tf = new TwitterFactory(cb.build());
  17.         this.twitter = tf.getInstance();
  18.     }
  19.     public Twitter getTwitter() {
  20.         return twitter;
  21.     }
  22. }
Advertisement
RAW Paste Data Copied
Advertisement