本文整理汇总了Java中twitter4j.auth.OAuthAuthorization.setOAuthAccessToken方法的典型用法代码示例。如果您正苦于以下问题:Java OAuthAuthorization.setOAuthAccessToken方法的具体用法?Java OAuthAuthorization.setOAuthAccessToken怎么用?Java OAuthAuthorization.setOAuthAccessToken使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类twitter4j.auth.OAuthAuthorization
的用法示例。
在下文中一共展示了OAuthAuthorization.setOAuthAccessToken方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getInstance
import twitter4j.auth.OAuthAuthorization; //导入方法依赖的package包/类
/**
* 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);
}
示例2: AbsUploadProviderImpl
import twitter4j.auth.OAuthAuthorization; //导入方法依赖的package包/类
public AbsUploadProviderImpl(final Configuration confOrig, final AccountWithCredentials account) {
this.account = account;
final ConfigurationBuilder cb = new ConfigurationBuilder(confOrig);
cb.setOAuthConsumerKey(account.consumer_key);
cb.setOAuthConsumerSecret(account.consumer_secret);
cb.setRestBaseURL(account.rest_base_url);
cb.setOAuthBaseURL(account.oauth_base_url);
cb.setSigningRestBaseURL(account.signing_rest_base_url);
cb.setSigningOAuthBaseURL(account.signing_oauth_base_url);
conf = cb.build();
oauth = new OAuthAuthorization(conf);
oauth.setOAuthAccessToken(new AccessToken(account.oauth_token, account.oauth_token_secret));
oauth.setOAuthRealm("https://api.twitter.com/");
client = new HttpClientWrapper(confOrig);
}
示例3: getInstance
import twitter4j.auth.OAuthAuthorization; //导入方法依赖的package包/类
/**
* 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);
}
示例4: getInstance
import twitter4j.auth.OAuthAuthorization; //导入方法依赖的package包/类
/**
* 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);
}
示例5: getOAuthOuthorization
import twitter4j.auth.OAuthAuthorization; //导入方法依赖的package包/类
private OAuthAuthorization getOAuthOuthorization(Configuration conf) {
OAuthAuthorization oauth = new OAuthAuthorization(conf);
oauth.setOAuthConsumer(desktopConsumerKey, desktopConsumerSecret);
oauth.setOAuthAccessToken(new AccessToken(id1.accessToken, id1.accessTokenSecret));
return oauth;
}