/** * Returns a OAuth Authenticated instance.<br> * consumer key and consumer Secret must be provided by twitter4j.properties, or system properties.<br> * Unlike {@link Twitter#setOAuthAccessToken(twitter4j.auth.AccessToken)}, this factory method potentially returns a cached instance. * * @param accessToken access token * @return an instance * @since Twitter4J 2.1.9 */ public Twitter getInstance(AccessToken accessToken) { String consumerKey = conf.getOAuthConsumerKey(); String consumerSecret = conf.getOAuthConsumerSecret(); if (null == consumerKey && null == consumerSecret) { throw new IllegalStateException("Consumer key and Consumer secret not supplied."); } OAuthAuthorization oauth = new OAuthAuthorization(conf); oauth.setOAuthAccessToken(accessToken); return getInstance(oauth); }
/** * Returns a OAuth Authenticated instance.<br> * consumer key and consumer Secret must be provided by twitter4j.properties, or system properties. * Unlike {@link TwitterStream#setOAuthAccessToken(twitter4j.auth.AccessToken)}, this factory method potentially returns a cached instance. * * @param accessToken access token * @return an instance */ public TwitterStream getInstance(AccessToken accessToken) { String consumerKey = conf.getOAuthConsumerKey(); String consumerSecret = conf.getOAuthConsumerSecret(); if (null == consumerKey && null == consumerSecret) { throw new IllegalStateException("Consumer key and Consumer secret not supplied."); } OAuthAuthorization oauth = new OAuthAuthorization(conf); oauth.setOAuthAccessToken(accessToken); return getInstance(conf, oauth); }
public OAuth2Authorization(Configuration conf) { this.conf = conf; setOAuthConsumer(conf.getOAuthConsumerKey(), conf.getOAuthConsumerSecret()); http = HttpClientFactory.getInstance(conf.getHttpClientConfiguration()); }
/** * Returns a OAuth Authenticated instance.<br> * consumer key and consumer Secret must be provided by twitter4j.properties, or system properties.<br> * Unlike {@link AsyncTwitter#setOAuthAccessToken(twitter4j.auth.AccessToken)}, this factory method potentially returns a cached instance. * * @param accessToken access token * @return an instance */ public AsyncTwitter getInstance(AccessToken accessToken) { String consumerKey = conf.getOAuthConsumerKey(); String consumerSecret = conf.getOAuthConsumerSecret(); if (null == consumerKey && null == consumerSecret) { throw new IllegalStateException("Consumer key and Consumer secret not supplied."); } OAuthAuthorization oauth = new OAuthAuthorization(conf); oauth.setOAuthConsumer(consumerKey, consumerSecret); oauth.setOAuthAccessToken(accessToken); return new AsyncTwitterImpl(conf, oauth); }
/** * @param conf configuration */ public OAuthAuthorization(Configuration conf) { this.conf = conf; http = HttpClientFactory.getInstance(conf.getHttpClientConfiguration()); setOAuthConsumer(conf.getOAuthConsumerKey(), conf.getOAuthConsumerSecret()); if (conf.getOAuthAccessToken() != null && conf.getOAuthAccessTokenSecret() != null) { setOAuthAccessToken(new AccessToken(conf.getOAuthAccessToken(), conf.getOAuthAccessTokenSecret())); } }
private void init() { if (null == auth) { String consumerKey = conf.getOAuthConsumerKey(); String consumerSecret = conf.getOAuthConsumerSecret();
String consumerKey = conf.getOAuthConsumerKey(); String consumerSecret = conf.getOAuthConsumerSecret();