title: owin token base authentication signout not working in asp.net web api 2
body: <p>I am trying to make Logout url. If user hit Logout url by pass header token then this token must expire. </p>
  
  <p>I did the code for the same, But it is not working. I didn't found solution in any blog.
  My code given below,</p>
  
  <p><strong>First Way (Not Working)</strong></p>
  
  <pre><code>[Route("Logout")]
  [HttpPost]
  public HttpResponseMessage Logout()
  {
      authentication.SignOut(Microsoft.AspNet.Identity.DefaultAuthenticationTypes.ApplicationCookie,
                            Microsoft.AspNet.Identity.DefaultAuthenticationTypes.ExternalCookie,
                            Microsoft.AspNet.Identity.DefaultAuthenticationTypes.TwoFactorRememberBrowserCookie,
                            Microsoft.AspNet.Identity.DefaultAuthenticationTypes.TwoFactorCookie);
  
      authentication.SignOut(Microsoft.AspNet.Identity.DefaultAuthenticationTypes.ExternalCookie);
      authentication.SignOut(Microsoft.AspNet.Identity.DefaultAuthenticationTypes.ApplicationCookie);
      authentication.SignOut();
  
  }
  </code></pre>
  
  <p><strong>Second Way (Not Working)</strong></p>
  
  <pre><code>[Route("LogOut")]
  [HttpPost]
  public HttpResponseMessage LogOut()
  {
      var identity = new ClaimsIdentity(HttpContext.Current.User.Identity);
  
  AuthenticationTicket ticket = new AuthenticationTicket(identity, new AuthenticationProperties()
  {
      ExpiresUtc = DateTime.Now.AddYears(-5)
  });
  ticket.Properties.ExpiresUtc = DateTime.Now.AddYears(-5);
  
  var principal = ClaimsPrincipal.Current;
  var ClientId = principal.Claims.FirstOrDefault(c =&gt; c.Type == Constants.USERID).Value;
  var USERNAME = principal.Claims.FirstOrDefault(c =&gt; c.Type == Constants.USERNAME).Value;
  var PASSWORD = principal.Claims.FirstOrDefault(c =&gt; c.Type == Constants.USER_PASSWORD).Value;
  
  var oAuthAuthorizationServerOptions = new OAuthAuthorizationServerOptions();
  oAuthAuthorizationServerOptions.AccessTokenExpireTimeSpan = TimeSpan.FromTicks(DateTime.UtcNow.AddYears(-5).Ticks);
  
  var context = new OAuthGrantResourceOwnerCredentialsContext(HttpContext.Current.GetOwinContext(), null, ClientId, USERNAME, PASSWORD, null);
  context.Validated(ticket);
  
  }
  </code></pre>
  
  <p>But token doesn't expire in both way.</p>
  
  <p>Help is highly appreciated.</p>
  
  <p>Thanks.</p>