title: AuthorizationCodeReceived event not firing
body: <p>I'm attempting to implement the OpenId Connect middleware in a an ASP.NET MVC 5 (.Net Framework) application. </p>
  
  <p>In my <code>AccountController.cs</code> I send an OpenID Connect sing-in request. I have another OpenId connect middleware implemented which is why I specify that the middleware I want to challenge against is "AlternateIdentityProvider".</p>
  
  <pre><code>    public void SignIn()
      {
          HttpContext.GetOwinContext().Authentication.Challenge(
              new AuthenticationProperties { RedirectUri = "/" },
              "AlternateIdentityProvider");
      }
  </code></pre>
  
  <p>Upon issuing a challenge against the middleware, the <code>RedirectToIdentityProvider</code> event in <code>Startup.cs</code> fires and I am redirected to the provider for sign in. However, after successfully signing in I am redirected to the specified redirect uri with the state and code parameters added as query parameters i.e. <a href="http://localhost:63242/singin-oidc/?state=State&amp;code=AuthorizationCode" rel="noreferrer">http://localhost:63242/singin-oidc/?state=State&amp;code=AuthorizationCode</a> (parameters removed for brevity), which results in a 404 as no such route exists in my application.</p>
  
  <p>Instead  I expected the successful signin to trigger the <code>AuthorizationCodeReceived</code> event where I can implement my additional logic. In fact none of the other events ever trigger.</p>
  
  <p>I have implemented an almost identical solution in ASP.Net Core 2.1 and here I am able to step through the different events as they trigger.</p>
  
  <p>The relevant code of my current <code>Startup.cs</code> is shown below. Note that the OpenId provider throws an error if the inital request include reponse_mode and some telemetry parameters, hence these are removed during the initial <code>RedirectToIdentityProvider</code> event.</p>
  
  <p>Any ideas why the callback from the OpenId provider is not getting picked up in the middleware?</p>
  
  <pre><code>        app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType);
  
          app.UseCookieAuthentication(new CookieAuthenticationOptions());
  
          app.UseOpenIdConnectAuthentication(
              new OpenIdConnectAuthenticationOptions("AlternateIdentityProvider")
          {
              ClientId = { { Client Id } },
              ClientSecret = { { Client Secret } },
              Scope = OpenIdConnectScope.OpenId,
              ResponseType = OpenIdConnectResponseType.Code,
              RedirectUri = "http://localhost:63242/singin-oidc",
              MetadataAddress = { { Discovery document url } },
  
              Notifications = new OpenIdConnectAuthenticationNotifications
              {
                  RedirectToIdentityProvider = context =&gt;
                  {
                      Debug.WriteLine("Redirecting to identity provider for sign in..");
  
                      context.ProtocolMessage.EnableTelemetryParameters = false;
                      context.ProtocolMessage.ResponseMode = null;
  
                      return Task.FromResult(0);
                  },
  
                  AuthorizationCodeReceived = context =&gt; {
  
                      Debug.WriteLine("Authorization code received..");
                      return Task.FromResult(0);
                  },
  
                  SecurityTokenReceived = context =&gt;
                  {
                      Debug.WriteLine("Token response received..");
                      return Task.FromResult(0);
                  },
  
                  SecurityTokenValidated = context =&gt;
                  {
                      Debug.WriteLine("Token validated..");
                      return Task.FromResult(0);
                  },
              }
          });
  </code></pre>