Refresh tokens and keeping tokens alive
What is the best way to implement refresh tokens using this approach? Thanks in advance.
I added a sample for generating refreshed tokens in #16
i am new in token. can i ask a question? when will i send a request to RefreshPath?
@anhlee24 That's up to you. You can calculate it by adding expiration time to current time.
@MihaMarkic you mean that if i set the expiration time by 30m. So i will setup the Client (SPA) to send a request to RefreshPath to keep it alive after 30m?
@anhlee24 Yes, but more likely slightly before expiration, like after 29m or something :)
Thank you so much!
@MihaMarkic Hi, I want to handle the acccess_token expiraton at server side, how can i handle it?
The response header contain: "Bearer error="invalid_token", error_description="The token is expired", but i don't know how to handle this error. Can you give me any suggest? Thank you :)
@anhlee24 Could it be that your token has actually expired? You have to request the refresh before it expires.
@MihaMarkic Yes. But i want to handle the token expiration in Client (SPA) to redirect to Login page or Unauthorized page, etc ...
@anhlee24 On client side you should catch Unauthorized response after each request and redirect app to login page somehow. This is really up to the client implementation.
@MihaMarkic Thank you so much :).