JWT token refresh (sliding sessions) and signout

落花浮王杯 提交于 2019-11-29 22:40:00
pedrofb

JWT life extension

You can issue a JWT with the old one. Your client app have to request a new JWT when it is close to expiration time. Client knows the expiration time reading the exp claim and can invoke a refresh service to get a new token. If the client app is closed then the JWT will expire and it will be necessary for the user to present the credentials again

Logout

It is recommended to let tokens expire, but you can use a blacklist to store JWT that are still valid but can not be used for authentication:

  • When user clicks logout

  • After refreshing a ticket close to expiration time

You will need to add to JWT an unique identifier jti. The blacklist will contain jti and exp. Once current time > exp the entry can be discarded.

See Invalidating client side JWT session

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!