Java application needs access to SharePoint 2013 REST API https://msdn.microsoft.com/en-us/library/office/jj860569.aspx
Would prefer to use BASIC authentication:
There are many examples of using the rest api's on the web but none seem to deal with authentication. Maybe I'm missing something really simple here.
This works manually via POSTMAN: http://tech.bool.se/basic-rest-request-sharepoint-using-postman/ but requires me to enter username and password in browser.
I've tried implementing this: HttpClientBuilder basic auth using
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.4.1</version>
</dependency>
This results in -> WARNING: NTLM authentication error: Credentials cannot be used for NTLM authentication: org.apache.http.auth.UsernamePasswordCredentials
Thanks @fateddy that does the trick: Remember to switch out UsernamePasswordCredentials("username", "password"));for NTCredentials(, , ,);
Using this maven dependency:
The authentication to SharePoint works:
And you end up with : HTTP/1.1 200 OK