User Authenticate in SharePoint using CSOM through Web APIs from different server


  • I am working on .net Web APIs where I am using sharepoint CSOM to connect to SharePoint. I have created a .net web application from where I am calling the Web API end points to perform the actions. We are using the AD authentication here.

    So the SharePoint, .net web API , and .net web application are hosted on the same IIS server (say Server 1). This scenario is working fine but when I am accessing the front end application from my local host or from any other front end application that is hosted on (Say server 2) the web api is returning Unauthorised error may be because the API is not able to get the current user context.

    ClientContext clientContext = new ClientContext(siteUrl);
    clientContext.Credentials = CredentialCache.DefaultNetworkCredentials;

    Here the client context is not able to get the current user as the request is coming from different server. 

    So what is the token that I should pass from Front End application to the web api end points may be as a header that I can further use it in ClientContext to perform SharePoint Operations.

    2018년 5월 17일 목요일 오후 12:12

모든 응답