I´m trying to connect my application with Sharepoint through the REST API. I´ve an authentication problem, because I don´t know the URL adress of the login page because when I connect to the sharepoint server, I automatically jump a window to authenticate, but it does not take me to an authentication page. It is what is called "digest authentication". Dou know if there is an authentication URL? Thank you


Try example in this post 1 or this post 2. I hope it will works for you well.

Post 2

In on-premise, we can use NetworkCredential to pass the Credentials for the REST request.

var siteUrl = "http://sp2013/sites/team";
var listName = "CustomList";
var loginName = @"domain\username";
var password = "xxx";

HttpWebRequest endpointRequest = (HttpWebRequest)HttpWebRequest.Create(siteUrl+"/_api/web/lists/getByTitle('"+listName+"')/items");

endpointRequest.Method = "GET";
endpointRequest.Accept = "application/json;odata=verbose";
NetworkCredential cred = new System.Net.NetworkCredential(loginName,password);
endpointRequest.Credentials = cred;
HttpWebResponse endpointResponse = (HttpWebResponse)endpointRequest.GetResponse();
    WebResponse webResponse = endpointRequest.GetResponse();
    Stream webStream = webResponse.GetResponseStream();
    StreamReader responseReader = new StreamReader(webStream);
    string response = responseReader.ReadToEnd();
    JObject jobj = JObject.Parse(response);
    JArray jarr = (JArray)jobj["d"]["results"];
    foreach (JObject j in jarr)
catch (Exception e)
    Console.Out.WriteLine(e.Message); Console.ReadLine();

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.