Search code examples
sharepoint-2013office365sharepoint-onlineoffice365-apps

Office 365 (SharePoint Online) C# Authentication from custom application using tokens


I have a custom c# windows forms application. How can I authenticate to Office 365 SharePoint Online in order to issue HttpWebRequest to customer web-sites using ACS tokens.

User will provide username and password and based on that I want to generate an ACS token that will allow the application to make requests on customer web-site. Also I want to be able to regenerate the token if it's expired, without reprompting username and password if possible.

if this will be a provider hosted app, then no problem is easy to do it but how can I achieve this from a custom application which is not a SharePoint app?


Solution

  • You will have to rewrite the code which supports [SharePointContextFilter] attribute which does the work in provider hosted app. Or port your web forms application to a provider hosted app template and deploy.