office365sharepoint-onlineapps-for-office

SharePoint Online (Office 365) login form in a Office task pane app


The end goal of what I am trying to achieve is to open a page from a SharePoint Online instance - any page, it doesn't matter - in a Office Task Pane app.

The issue is that the login page (https://login.microsoftonline.com) is shown fine, but when you click 'login' it posts to a new IE window that has the same login page in it. Upon doing this it loses the ReturnUrl and will only forward you to the SPO home page.

The URL I redirect the Office app to is https://mySpoSite.sharepoint.com/_login?ReturnUrl=MY_RETURN_URL

Obviously this is the wrong way to do it. Is there different way I can log in to the SPO environment that I haven't stumbled across yet?

It should be mentioned that this works perfectly in a web browser.

Ideally, I would not like use any server-side code for this, it would be able to authenticate client-side so that if the user has saved credentials in IE it would behave as IE would and pre-fill them.

Thanks in advance.

EDIT

Another idea I tried was to open the SPO login page in a popup window, and have to user login there before the app sent them to the SPO page, however this did not work as the session was not retained in the Office app. Is there a method in the Office api that allows you to open a popup that uses the Task Pane session?


Solution

  • The main solution to this was adding all of the domains the O365 login page uses to the AppDomains section of the manifest

    Seems that when you try to use content in the app from a domain other than what is registered, it opens the content in a new IE process.