title: Identity server 4 not removing cookie
body: <p>I have front app on angular 5 and backend api on c# using identity server. 
  The problem is that when I click logout button, the token is removed and i am redirected to logout page. </p>
  
  <p>But when I try to refresh main page, I am redirected to microsoftonline.com
  authenticated automatically and  redirected back to main page
  I am missing providing username and password here, and this occurs in chrome incognito.</p>
  
  <p>What I noticed is that if I remove manually the cookie from microsoftonline.com
  and repeat the process, this time I will be asked for username and password. </p>
  
  <p>So first I tried to clean all cookies this way but it din't help</p>
  
  <pre><code>foreach (var key in HttpContext.Request.Cookies.Keys)
  {
      HttpContext.Response.Cookies.Append(key, "", new CookieOptions() { Expires = DateTime.Now.AddDays(-1) });
  }
  </code></pre>
  
  <p>bellow is my accountcontroller logout method and cookie screen</p>
  
  <pre><code>[HttpPost]
  [ValidateAntiForgeryToken]
  public async Task&lt;IActionResult&gt; Logout(LogoutViewModel model)
  {
      var idp = User?.FindFirst(JwtClaimTypes.IdentityProvider)?.Value;
      var subjectId = HttpContext.User.Identity.GetSubjectId();
  
      if (idp != null &amp;&amp; idp != IdentityServerConstants.LocalIdentityProvider)
      {
          if (model.LogoutId == null)
          {
              model.LogoutId = await interaction.CreateLogoutContextAsync();
          }
  
          try
          {
              await signInManager.SignOutAsync();
          }
          catch (NotSupportedException)
          {
          }
      }
  
      // set this so UI rendering sees an anonymous user
      HttpContext.User = new ClaimsPrincipal(new ClaimsIdentity());
  
      // get context information (client name, post logout redirect URI and iframe for federated signout)
      var logout = await interaction.GetLogoutContextAsync(model.LogoutId);
  
      var vm = new LoggedOutViewModel
      {
          PostLogoutRedirectUri = logout?.PostLogoutRedirectUri,
          ClientName = logout?.ClientId,
          SignOutIframeUrl = logout?.SignOutIFrameUrl
      };
  
      await persistedGrantService.RemoveAllGrantsAsync(subjectId, "angular2client");
  
      return View("LoggedOut", vm);
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/kMmeX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kMmeX.png" alt="enter image description here"></a></p>