3

Recently I created token based authentication for my Web API project following an Article here I am able to create the token and able to validate the token as well. But when user logged out we are removing the token from user device, if the user saved the token before we remove that token, it still valid until it reaches the expiration time, which leads less security for the API

Can any once suggest how can I expire the the issued token. (as we have huge user database we are not storing any tokens in database.)

1
  • This post describes the problem and possible approaches. Keep token lifetimes short, refresh when needed, possibly maintain a 'token revocation list' in some sort of fast access store - stackoverflow.com/a/23089839/1538039 Commented Oct 8, 2018 at 16:06

1 Answer 1

1
You can clear cookies and entire session if exists any ! Request.GetOwinContext().Authentication.SignOut(); Request.GetOwinContext().Authentication.SignOut(Microsoft.AspNet.Identity.DefaultAuthenticationTypes.ApplicationCookie); HttpContext.Current.GetOwinContext().Authentication.SignOut(Microsoft.AspNet.Identity.DefaultAuthenticationTypes.ApplicationCookie) 
Sign up to request clarification or add additional context in comments.

1 Comment

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.