2

I have a .NET website that allows viewing files located in SharePoint Online, among other clouds. So far we used asked the users for the SharePoint site address, the username and the password in order to do the authentication and then made REST calls to SharePoint API, together with sending the FedAuth cookie.

Recently, we decided to use the standard Office 365 login. To accomplish this, I composed an URL like

https://login.microsoftonline.com/login.srf?wa=wsignin1%2E0&rpsnv=3&ct=1402399134&rver=6%2E1%2E6206%2E0&wp=MBI&wreply=https%3A%2F%2Fwww10226%2Esharepoint%2Ecom%2F_layouts%2F15%2Flanding%2Easpx%3FSource%3Dhttp%3A%2F%2Flocalhost%3A1676%2FtViews.aspx

The login appears and after entering the SharePoint credentials, the page is redirected to my site, but I cannot authenticate the following API calls, not having the FedAuth cookie.

Can anybody please help me with an answer or point me in the right direction? Am I thinking about it wrong? I just want this flow to work (having users login via standard window and be able to access resources without my website knowing their SharePoint online password).

Thank you in advance.

0

Register your app with the SharePoint site containing the document library: http://msdn.microsoft.com/en-us/library/jj687469%28v=office.15%29.aspx#Reg

Then, request permissions (including app-only policy) using http://yourServerName/_layouts/15/appinv.aspx.

The permission request must be approved. Once the approval happens, your app can "log in" to the site using the App Id and App Secret.

  • Paul, many thanks for your answer. I am not sure I understand the "one tenant" concept. Does it refer to one website (I am okay with that) or does it mean that it's bound to one SharePoint Online site? I need this to work with multiple SharePoint addresses. I am concerned by the "yourServerName" part as I am almost sure this is a one time process, not something you do dynamically for every SharePoint site. Am I wrong? – Crina Jun 10 '14 at 23:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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