I have a working SharePoint provider hosted app, with an MVC web application residing on an Azure Web site. Entering the full screen app page, everything looks as expected.
Adding a client web part or manually adding an iframe via a Script Editor web part, pointing at the exact same web application, results in no context token returned from the TokenHelper.
I have the following method in an MVC controller:
public ActionResult Index()
{
var contextToken = TokenHelper.GetContextTokenFromRequest(Request);
// store the context token to use subsequently
return View();
}
Further investigation reveals that the TokenHelper.GetContextTokenFromRequest
returns null as the request form does not contain the "SPAppToken", when called from the iframe.
Can someone shed some light on the difference between the fullscreen app and the app hosted in an iframe/client web part?