当前位置: 首页>>代码示例>>Java>>正文


Java OAuthAuthorization.setOAuthAccessToken方法代码示例

本文整理汇总了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);
}
 
开发者ID:sprinklr-inc,项目名称:twitter4j-ads,代码行数:20,代码来源:TwitterFactory.java

示例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);
}
 
开发者ID:mariotaku,项目名称:twidere.extension.mediauploader,代码行数:16,代码来源:AbsUploadProviderImpl.java

示例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);
}
 
开发者ID:SamKnows,项目名称:skandroid-core,代码行数:20,代码来源:AsyncTwitterFactory.java

示例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);
}
 
开发者ID:SamKnows,项目名称:skandroid-core,代码行数:19,代码来源:TwitterStreamFactory.java

示例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;
}
 
开发者ID:SamKnows,项目名称:skandroid-core,代码行数:7,代码来源:DAOTest.java


注:本文中的twitter4j.auth.OAuthAuthorization.setOAuthAccessToken方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。