I've created my own AzureIdentityProvider script in the
owin.IdentityProviders configuration, and I'm trying to make the redirect URL and post-login redirect URL more dynamic, based on the URL it's being fired from. I've tried using the
Request.ServerVariables to get the HTTP_HOST (null, as are most of the server variables), or
HttpContext.Current.Request.Url.Host (returns 127.0.0.1 regardless of my local IIS or my Azure PaaS), or
Sitecore.Context.Site is null).
This pipeline seems to be fired very early in the process, I'm guessing by design, though I'm using it for an external login, not the Sitecore shell. This was originally done for a 9.0.1 site when federated authentication was new, but we upgraded to 9.3 recently. Beyond trying this trick, everything works fine if we just preset the values in the config.
Is this a pipeline that can be moved and fired a bit later to get the server variables or Sitecore context, or is this one more immutable and we need to find another way to handle this?