List of usage examples for twitter4j.conf ConfigurationBuilder setOAuth2TokenType
public ConfigurationBuilder setOAuth2TokenType(String oAuth2TokenType)
From source file:Beans.Crawler.java
/** * Get a fully application-authenticated Twitter object useful for making subsequent calls. * * @return Twitter4J Twitter object that's ready for API calls */// w w w. ja va 2s.c om public static Twitter getTwitter() { OAuth2Token token; // First step, get a "bearer" token that can be used for our requests token = getOAuth2Token(); // Now, configure our new Twitter object to use application authentication and provide it with // our CONSUMER key and secret and the bearer token we got back from Twitter ConfigurationBuilder cb = new ConfigurationBuilder(); cb.setApplicationOnlyAuthEnabled(true); cb.setOAuthConsumerKey(CONSUMER_KEY); cb.setOAuthConsumerSecret(CONSUMER_SECRET); cb.setOAuth2TokenType(token.getTokenType()); cb.setOAuth2AccessToken(token.getAccessToken()); // And create the Twitter object! return new TwitterFactory(cb.build()).getInstance(); }
From source file:br.com.controller.TweetController.java
public static Twitter getTwitter() { OAuth2Token token;//from w w w . ja v a 2s .co m token = getOAuth2Token(); ConfigurationBuilder cb = new ConfigurationBuilder(); cb.setApplicationOnlyAuthEnabled(true); cb.setOAuthConsumerKey(CONSUMER_KEY); cb.setOAuthConsumerSecret(CONSUMER_SECRET); cb.setOAuth2TokenType(token.getTokenType()); cb.setOAuth2AccessToken(token.getAccessToken()); return new TwitterFactory(cb.build()).getInstance(); }
From source file:com.data.dataanalytics.twitter.TwitterFeed.java
/** * Get a fully application-authenticated Twitter object useful for making subsequent calls. * */// ww w.ja va 2 s .c o m protected static twitter4j.Twitter getTwitter() { OAuth2Token token; // First step, get a "bearer" token that can be used for our requests token = getOAuth2Token(); // Now, configure our new Twitter object to use application authentication and provide it with // our CONSUMER key and secret and the bearer token we got back from Twitter ConfigurationBuilder cb = new ConfigurationBuilder(); cb.setApplicationOnlyAuthEnabled(true); cb.setOAuthConsumerKey(CONSUMER_KEY); cb.setOAuthConsumerSecret(CONSUMER_SECRET); cb.setOAuth2TokenType(token.getTokenType()); cb.setOAuth2AccessToken(token.getAccessToken()); // Create the Twitter object return new TwitterFactory(cb.build()).getInstance(); }
From source file:ontoSentiment.Util.java
public static Twitter getTwitter() { OAuth2Token token;/*from w w w . jav a2 s .c om*/ token = getOAuth2Token(); ConfigurationBuilder cb = new ConfigurationBuilder(); cb.setApplicationOnlyAuthEnabled(true); cb.setOAuthConsumerKey(CONSUMER_KEY); cb.setOAuthConsumerSecret(CONSUMER_SECRET); cb.setOAuth2TokenType(token.getTokenType()); cb.setOAuth2AccessToken(token.getAccessToken()); return new TwitterFactory(cb.build()).getInstance(); }
From source file:tweetdownloader.cnr_stable.version.TwitterAuthHandler.java
/** * This method give you the auth to work with Twitter API * @return istance of Twitter// w w w . j a v a 2 s. c o m */ public Twitter getTwitter() { OAuth2Token token; token = getOAuth2Token(); ConfigurationBuilder cb = new ConfigurationBuilder(); cb.setApplicationOnlyAuthEnabled(true); cb.setOAuthConsumerKey(CONSUMER_KEY); cb.setOAuthConsumerSecret(CONSUMER_SECRET); cb.setOAuth2TokenType(token.getTokenType()); cb.setOAuth2AccessToken(token.getAccessToken()); return new TwitterFactory(cb.build()).getInstance(); }