实现JWT刷新机制以及让过期时间更精确


 
借助accessToken和refreshToken实现
 
accessToken控制刷新间隔,refreshToken控制最长过期时间
 
Min过期时间 = refreshToken过期时间 - accessToken过期时间
Max过期时间 = refreshToken过期时间
实际过期时间是一个范围,在(Min过期时间 ~ Max过期时间)之间
 
如:refreshToken过期时间1小时,accessToken过期时间为5分钟
则实际过期时间是55分钟 ~ 60分钟
 
因此,refreshToken过期时间和accessToken过期时间相差越大,实际过期时间就越精确
原文地址:https://www.cnblogs.com/gdufs/p/9015861.html