oauthho.oAuthVersion = OAuthVersion.OAUTH1;
GenericOAuth10aApi oauth10aApi = new GenericOAuth10aApi();
oauth10aApi.setAccessTokenEndpoint(providerConfig.getAccess_token_url());
oauth10aApi.setAuthorizationUrl(providerConfig.getAuthorization_url());
oauth10aApi.setRequestTokenEndpoint(providerConfig.getRequest_token_url());
oauthho.oauthService = new ServiceBuilder()
.provider(oauth10aApi)
.apiKey(oauthho.apiKey)
.apiSecret(oauthho.apiSecret)
.build();
} else if (providerConfig.getOAuth_version() == 2.0) {
if (providerConfig.getCallback_url() == null) {
throw new ScriptException("API configuration not specified");
}
oauthho.oAuthVersion = OAuthVersion.OAUTH2;
GenericOAuth20Api oauth20Api = new GenericOAuth20Api();
oauth20Api.setAccessTokenEP(providerConfig.getAccess_token_url());
oauth20Api.setAuthorizeUrl(providerConfig.getAuthorization_url());
oauthho.oauthService = new ServiceBuilder()
.provider(oauth20Api)
.apiKey(oauthho.apiKey)
.apiSecret(oauthho.apiSecret)
.build();
}