0
votes

I'm working with an ASP.NET application. My page display content (images) from SharePoint Online. Certainly if I want to display something from SharePoint, I must be authenticated first. So I wrote a script to check if user is logged in or not. If not, a window will open and navigate to SharePoint sign in page.

The question is how to close this sign in window after user do the authentication? I've tried the solution here Close window, after redirect but it only works with local site, with login page from different domain (SharePoint Online), it return "Access is denied" error due to Cross Frame scripting prevention.

So any other solution?

2

2 Answers

0
votes

I think , When a user clicks Ok and authentication code runs and authenticate the user, you could run a code or javascriupt to close the window.

Correct me if i miss something

0
votes

I've found the solution. Create an .aspx page on SharePoint, place JavaScript to close the window (window.close) in it.

Then from web application, if user not logged in SharePoint Online, open new window and navigate to the .aspx page above.

SharePoint then redirect you to Microsoft Online sign in address first. After authentication, it bring you back to where you come, the .aspx page, then the JavaScript execute and close the window.