Any one successfully use smartsheet sdk java 2.25 with proxy autnentication and CredentialsProvider? Below Apache httpclient 4.5 sample code works in our company, but smartsheet sdk api not works at all with proxy autnentication. I try to find out smartsheet object if it can set CredentialsProvider but unfortunately I don't see any method to set credentialprovider.
Any one know how to implement user name and password with smartsheet api proxy authentication ?
CredentialsProvider credsProvider = new BasicCredentialsProvider();
credsProvider.setCredentials(
new AuthScope("proxy", 8080),
new UsernamePasswordCredentials("username", "password"));
CloseableHttpClient httpclient = HttpClients.custom()
.setDefaultCredentialsProvider(credsProvider).build();
try {
HttpHost target = new HttpHost("api.smartsheet.com", 443, "https");
HttpHost proxy = new HttpHost("proxy", 8080);
RequestConfig config = RequestConfig.custom()
.setProxy(proxy)
.build();
HttpGet httpget = new HttpGet("/2.0/sheets");
httpget.setConfig(config);
System.out.println("Executing request " + httpget.getRequestLine() + " to " + target + " via " + proxy);
CloseableHttpResponse response = httpclient.execute(target, httpget);
try {
System.out.println("----------------------------------------");
System.out.println(response.getStatusLine());
System.out.println(EntityUtils.toString(response.getEntity()));
} finally {
response.close();
}
} finally {
httpclient.close();
}
I have tried Apache sameple code and it works well with proxy authentication.