X-SpringBoot icon indicating copy to clipboard operation
X-SpringBoot copied to clipboard

token缓存bug

Open ohyes666 opened this issue 2 years ago • 0 comments

你好,感觉这似乎是一个Bug。 前端common.js 24行将token从localStorage取出。只要token存在则放入header中。 所以哪怕是登录接口,都将会带有token参数。 若长时间不登录,后端redis中此token将消失。 当前端调用登录接口后,AuthenticationTokenFilter的51行取不到userid.则将返回“无效token” 这时前端将刷新login页面,导致无法登录。

我的解决方案是在login.html的153行加入 localStorage.removeItem("token"); 当登录错误时就删除旧token。

不知道我的提问是否正确,期待回复,谢谢。

ohyes666 avatar Mar 25 '22 14:03 ohyes666