When using a direct link(bookmark) to a page in my provided app the "SPAppWebUrl" query string is missing and the SPContext.CreateAppOnlyClientContextForSPAppWeb() is null.
This happens after the current user has been authenticated in the "SharePointContextProvider.CheckRedirectionStatus" method:
protected void Page_PreInit(object sender, EventArgs e)
{
switch (SharePointContextProvider.CheckRedirectionStatus(Context, out redirectUrl))
{
case RedirectionStatus.Ok:
return;
case RedirectionStatus.ShouldRedirect:
Response.Redirect(redirectUrl.AbsoluteUri, endResponse: true);
break;
case RedirectionStatus.CanNotRedirect:
Response.Write("An error occurred while processing your request.");
Response.End();
break;
}
}
The original direct link to page has the query parameters "SPHostUrl" and "SPAppWebUrl" and is working fine if the user already have been authenticated.
The "SPAppWebUrl" parameter is empty and "AppOnlyAccessTokenForSPAppWeb" is null after the current user has been authenticated running when the "RedirectionStatus.ShouldRedirect":

If the current user already has been authenticated in SP before accessing the page (RedirectionStatus.Ok), everything is working fine:

In the AppManifest.xml i am using query strings:

The {StandarsTokens} have the "SPAppWebUrl" query string.
I really appreciate if someone can help me!