0

This is regarding the post: BASIC authentication from JAVA to Sharepoint 2013 REST API

I am facing the same problem.

I tried the solutions provided over here but it did not work out for me. I am trying my luck to get the SharePoint Rest API working with Java but to no avail. It is showing the below error response:

Oct 03, 2017 8:23:49 PM org.apache.http.impl.auth.HttpAuthenticator generateAuthResponse

WARNING: NEGOTIATE authentication error:
No valid credentials provided
(Mechanism level: No valid credentials provided
(Mechanism level: Failed to find any Kerberos tgt))
----------------------------------------
HTTP/1.1 401 Processed
James Z
  • 12,209
  • 10
  • 24
  • 44

1 Answers1

0

If you have enabled NTLM authentication , then you can try NTLM auth from java. This example might help you , because following the same worked for me .

http://www.muneebahmad.com/index.php/archives/127

If you have Digest type of auth then you can refer this ,

http://www.whypad.com/posts/authenticate-sharepoint-rest-call-in-a-rest-client/1169/

Arun Kumar G R
  • 178
  • 2
  • 13
  • it did not work. tried it out, still getting the same error – Ratnadip Chaudhuri Oct 16 '17 at 08:38
  • are you hitting the domain controller machine ( where the sharepoint is installed ) with the installed port ? I sometimes get 500 server error , that time I RDPlogin controller vm and hit the api (http://localhost:1026/_api/web/lists) using REST cli using firefox [plugin](https://addons.mozilla.org/fr/firefox/addon/restclient/) , after that again I try from external vm it worked and responded 200 instead of 500.. Other than that I have never faced any issues. Also in IIS Admin CP , check windows auth is enabled . – Arun Kumar G R Oct 16 '17 at 11:13
  • Actually, when i try to hit the rest api from local machine using browser, it works, but when i am trying to do that programatically, it does not work. I am working in an SSO (Single Sign-on) environment, if that could cause any issue. – Ratnadip Chaudhuri Oct 16 '17 at 14:25
  • What type of authentication you are using for sharpoint ? NTLM ( windows domain users ) or kerbros ? – Arun Kumar G R Oct 16 '17 at 14:29
  • We are using NTLM – Ratnadip Chaudhuri Oct 16 '17 at 14:41
  • @RatnadipChaudhuri we are also using the same .. that Java sample works flawlessly. Check it out man. – Arun Kumar G R Oct 16 '17 at 14:45
  • hi, my fault, we are using kerberos... now how can i go forward? – Ratnadip Chaudhuri Oct 17 '17 at 07:56
  • @ArunKumarGR Have you got any luck to solve the 500 server error issue? – Selim Alawwa Apr 21 '19 at 11:55
  • 1
    @SelimAlawwa it happens cuz of login. hit an sharepoint api from sharepoint server itself in firefox . It will ask for login , use credentials to login and the error will go off. It was the workaround then but now I am not working on that. Good luck for finding the real cause . – Arun Kumar G R Apr 23 '19 at 10:57