I am building an app in which the HTML/JavaScript client is required to be embedded within an iframe provided by the platform provider. The containing frame provides infrastructural services including identity management. The server in my app is ASP.NET
MVC 4 using Adam Wilson's excellent
DataMarket OAuth Sample.
I believe (though this is only from a cursory evaluation that appears to prove the point), that Azure DataMarket pages will not load when accessed from an iframe embedded page. Specifically, GETting the 'consent' request (URL below) is 'canceled', as are
other pages on the site including the root/default page. I was able to reproduce the problem by adding the links to the HTML panel in jsFiddle (which, by design, runs the panels within iframes) and by manually concocting an HTML page containing an iframe referencing
the DataMarket URL.
https://datamarket.azure.com/embedded/consent
A simple solution to my predicament would appear to be opening the page that triggers the OAuth flow in a separate tab/window. This won't be constrained by an iframe, the DataMarket pages should work and the cookie should be created. The separate tab/window
will then need to close itself and refresh the page from which it was called.
Questions
- Is this an appropriate/secure approach?
- Is there a better way?
- Am I misunderstanding something?