title: Pass custom header value to IdentityServer4 Login
body: <p>I am trying to pass a custom header value (no cookies) to IdentityServer4 as the user attempts to login. Here is how its all setup. </p>
  
  <p>Custom authorisation attribute:</p>
  
  <pre><code>[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true, Inherited = true)]
  public class CustomAuthorizeAttribute : AuthorizeAttribute, IAuthorizationFilter
  {
      private readonly string _customId;
  
      public CustomAuthorizeAttribute(string customId)
      {
          _customId = customId;
      }
  
      public void OnAuthorization(AuthorizationFilterContext context)
      {
          context.HttpContext.Request.Headers.Add("X-CustomId", _customId);
      }
  }
  </code></pre>
  
  <p>Controller:</p>
  
  <pre><code>[CustomAuthorize("0123456789")]
      public IActionResult Secure()
      {
          ViewData["Message"] = "Secure Page.";
  
          return View();
      }
  </code></pre>
  
  <p>IdentityServer > AccountControlelr:</p>
  
  <pre><code>[HttpGet]
      public async Task&lt;IActionResult&gt; Login(string returnUrl)
      {
          var customId = _httpContextAccessor.HttpContext.Request.Headers["X-CustomId"];
  
          // build a model so we know what to show on the login page
          var vm = await BuildLoginViewModelAsync(returnUrl);
  
          if (vm.IsExternalLoginOnly)
          {
              // we only have one option for logging in and it's an external provider
              return await ExternalLogin(vm.ExternalLoginScheme, returnUrl);
          }
  
          return View(vm);
      }
  </code></pre>
  
  <p>The custom header value never makes it to any of the login endpoints. Wondering if anyone has come across this before and have any ideas how to get it working? Many Thanks</p>