本文整理汇总了Java中net.dean.jraw.http.oauth.Credentials.script方法的典型用法代码示例。如果您正苦于以下问题:Java Credentials.script方法的具体用法?Java Credentials.script怎么用?Java Credentials.script使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.dean.jraw.http.oauth.Credentials
的用法示例。
在下文中一共展示了Credentials.script方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ScraperBot
import net.dean.jraw.http.oauth.Credentials; //导入方法依赖的package包/类
public ScraperBot() throws OAuthException {
UserAgent agent = UserAgent.of("script", "io.github.<username>", "v0.1", "<username>");
client = new RedditClient(agent);
Credentials cred = Credentials.script("<username>", "<password>", "<public key>", "<private key>");
OAuthData data = client.getOAuthHelper().easyAuth(cred);
client.authenticate(data);
posts = new HashMap<>();
}
示例2: init
import net.dean.jraw.http.oauth.Credentials; //导入方法依赖的package包/类
public void init() {
log.info("got here");
try {
UserAgent myUserAgent = UserAgent.of("desktop", "com.flowchat", "v0.1", "dessalines");
redditClient = new RedditClient(myUserAgent);
Credentials credentials = Credentials.script(DataSources.PROPERTIES.getProperty("reddit_username"),
DataSources.PROPERTIES.getProperty("reddit_password"),
DataSources.PROPERTIES.getProperty("reddit_client_id"),
DataSources.PROPERTIES.getProperty("reddit_client_secret"));
OAuthData authData = redditClient.getOAuthHelper().easyAuth(credentials);
redditClient.authenticate(authData);
} catch (OAuthException e) {
e.printStackTrace();
}
}
示例3: buildCredentials
import net.dean.jraw.http.oauth.Credentials; //导入方法依赖的package包/类
private Credentials buildCredentials(){
String username = properties.getProperty("credentials.username");
String password = properties.getProperty("credentials.password");
String clientId = properties.getProperty("credentials.client.id");
String clientSecret = properties.getProperty("credentials.client.secret");
String redirectUrl = properties.getProperty("credentials.redirect.url");
return Credentials.script(username, password, clientId, clientSecret, redirectUrl);
}
示例4: authenticate
import net.dean.jraw.http.oauth.Credentials; //导入方法依赖的package包/类
public AuthHelper authenticate() throws NetworkException, OAuthException{
AuthHelper helper = new AuthHelper();
UserAgent myUserAgent = UserAgent.of("desktop", "YouTubeBot", "0.1", "-YouTubeBot-");
RedditClient redditClient = new RedditClient(myUserAgent);
Credentials credentials = Credentials.script("-YouTubeBot-", "Ash3win#", "WnBQphrJ2jWY5A", "bJmaYXBDHUNfPGRpSEUPHOtLrIk");
OAuthData authData = redditClient.getOAuthHelper().easyAuth(credentials);
redditClient.authenticate(authData);
helper.setCredentials(credentials);
helper.setRedditClient(redditClient);
return(helper);
}
示例5: authReddit
import net.dean.jraw.http.oauth.Credentials; //导入方法依赖的package包/类
public static RedditClient authReddit() throws OAuthException {
System.out.println("Reauthenticating Reddit");
Credentials credentials = Credentials.script("DiscordPastaBot", Keys.RedditPass, Keys.RedditID, Keys.RedditSecret);
redditClient.authenticate(redditClient.getOAuthHelper().easyAuth(credentials));
return redditClient;
}