Search code examples
c#restionic3asp.net-identity

Token validation


In my web Api I am using asp.net owin identity framework to get user authenticated to use web api. Im going to consume this api in my app, the app will call this api in the background , on first call the app will recieve token and i will save this token in local storage. Then use this token on subsequent Web app call. Now the problem that I'm facing is ,how to check if the token is not expired. My plan is to set the expiry of the token to one year. I was wondering if there is a way to validate the token if the token is still valid. I'm developing app in ionic framework.

Thanks.


Solution

  • I manage to do it , by creating a separate method with Authrorize attribute. To check Token validity I am sending request to this method. If token is invalid this method return 401 , 200 otherwise.

    Thanks