SharePoint 2013 on-premise REST APIs authentication from web application hosted outside SharePoint

Copper Contributor

We have a requirement wherein, we will need to retreive some data from sites and lists hosted in SharePoint 2013 on-premise into an externally hosted .Net web application. The obvious thought was to the execute SharePoint REST APIs from the externally hosted .Net web application however, we got stuck with the authentication issue as it will be cross-domain.
The .Net web application is also expected to support AD authentication however, how to get it to pass the same to the REST API request?
 
Hence, we were thinking what are the options, one thought is to use the cross-domain library from SharePoint however, we couldn't find samples around this (most of what we find where actually related to apps/addins).
 
So, is cross-domain library is the only option for our scenario or are there any more options? Please suggest.

5 Replies

Your .Net web application will need to use the TokenHelper.cs classes to request an access token. That access token must be sent in the Authorization header.

 

Unless you have already configured your farm to connect with an O365 tenant, you should use the S2S methods in TokenHelper.

I believe tokenhelper will be useful in SharePoint Online scenarios however, as mentioned we are completely working on SharePoint On-premise.

So, both SharePoint and .Net web application reside on-premise however hosted separately in different envrionments in on-premise.

Believe you mean establishing a server to server trust?

In case there are any blogs/articles that provide additioanl details on how to setup this for an on-premise scenarios will be helpful.