Authenticator.setDefault(new Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication("username", "password".toCharArray());
}
});
URL url = new URL("http://example.com/");
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestProperty("Authorization", "Digest username=\"user\", realm=\"example.com\", nonce=\"123456\"");
OAuth10aService service = new ServiceBuilder(clientId)
.apiSecret(clientSecret)
.build(new OAuth10aApi(authorizeUrl, accessTokenUrl));
Token accessToken = service.getAccessToken(requestToken, verifier);
OAuthService service = new ServiceBuilder(clientId)
.apiSecret(clientSecret)
.build(new OAuthApi(authorizeUrl, accessTokenUrl));
Token accessToken = service.getAccessToken(requestToken, verifier);