title: OWIN SignOut doesn't remove cookie
body: <p>I am using the OWIN middleware in an external Authentication Server that my applications authenticate to using OAuth Authorisation Code Grant flow.</p>
  
  <p>I can redirect to the Authentication Server, authenticate against an external provider (Google) and redirect back to my client application with a logged in user and Application Cookie set just fine, however when I try to sign out the cookie remains after I call the <code>AuthenticationManager.SignOut</code> method.</p>
  
  <p>My cookie options in <code>Startup.Auth.cs</code> are:</p>
  
  <pre><code>var cookieOptions = new CookieAuthenticationOptions
                      {
                          Provider = cookieProvider,
                          AuthenticationType = "Application",
                          AuthenticationMode = AuthenticationMode.Passive,
                          LoginPath = new PathString("/Account/Index"),
                          LogoutPath = new PathString("/Account/Logout"),
                          SlidingExpiration = true,
                          ExpireTimeSpan = TimeSpan.FromMinutes(30),
                      };
  app.UseCookieAuthentication(cookieOptions);
  app.SetDefaultSignInAsAuthenticationType(DefaultAuthenticationTypes.ExternalCookie);
  app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);
  </code></pre>
  
  <p>My login method:</p>
  
  <pre><code>var loginInfo = await AuthManager.GetExternalLoginInfoAsync();
  SignInManager.ExternalSignInAsync(loginInfo, true);
  var identity = AuthManager.AuthenticateAsync(DefaultAuthenticationTypes.ExternalCookie).Result.Identity;
  
  if (identity != null)
  {
      AuthManager.SignIn(
                    new AuthenticationProperties {IsPersistent = true},
                    new ClaimsIdentity(identity.Claims, "Application", identity.NameClaimType, identity.RoleClaimType));
  
          var ticket = AuthManager.AuthenticateAsync("Application").Result;
          var identity = ticket != null ? ticket.Identity : null;
          if (identity == null)
          {
              AuthManager.Challenge("Application");
              return new HttpUnauthorizedResult();
          }
  
          identity = new ClaimsIdentity(identity.Claims, "Bearer", identity.NameClaimType, identity.RoleClaimType);
          AuthManager.SignIn(identity);
  }
  
  return Redirect(Request.QueryString["ReturnUrl"]);
  </code></pre>
  
  <p>Sign Out method:</p>
  
  <pre><code>var authTypeNames = new List&lt;string&gt;();
  authTypeNames.Add("Google");
  authTypeNames.Add("Application");
  authTypeNames.Add("Bearer");
  authTypeNames.Add(DefaultAuthenticationTypes.ExternalCookie);
  
  Request.GetOwinContext().Authentication.SignOut(authTypeNames.ToArray());
  </code></pre>
  
  <p>I have looked at other questions like:
  <a href="https://stackoverflow.com/questions/27252339/owin-authentication-expire-current-token-and-remove-cookie?rq=1">OWIN authentication, expire current token and remove cookie</a>
  and
  <a href="https://stackoverflow.com/questions/32592787/owin-authentication-signout-doesnt-remove-cookies/32742102#32742102">OWIN - Authentication.SignOut() doesn&#39;t remove cookies</a></p>
  
  <p>with no luck. I'm aware I could manually delete the cookie by setting a negative expiry date, but I'd prefer to use in built method if possible.</p>
  
  <p>How do I get the Application Cookie to be removed when I Sign Out?</p>