实现JWT刷新机制以及让过期时间更精确
借助accessToken和refreshToken实现
accessToken控制刷新间隔,refreshToken控制最长过期时间
Min过期时间 = refreshToken过期时间 - accessToken过期时间
Max过期时间 = refreshToken过期时间
实际过期时间是一个范围,在(Min过期时间 ~ Max过期时间)之间
如:refreshToken过期时间1小时,accessToken过期时间为5分钟
则实际过期时间是55分钟 ~ 60分钟
因此,refreshToken过期时间和accessToken过期时间相差越大,实际过期时间就越精确
【推荐】还在用 ECharts 开发大屏?试试这款永久免费的开源 BI 工具!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步