Laravel + jwt 令牌
是否可以?
- jwt 为每个请求生成 20 分钟的过期时间,
- 中间件检查 jwt 过期时间,如果它低于 2 分钟,它会在响应中添加新令牌 - 当前端收到带有新令牌的响应时,旧令牌当然在接下来的 2 分钟内仍然有效,
- 它会启动在下一个请求中使用它(如果有一些正在进行的请求,同时它们使用仍然有效的旧令牌)
Is it possible?
- jwt is generated with 20mins expiration time
- for each request middleware checks jwt expiration time and if its lower than lets say 2 min it adds new token in response - old token of course is still valid for next 2mins
- when frontend received response with new token it starts using it in next requests (if there was some ongoing requests meantime they use old token which is still valid)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用此 jwt 包: https://github.com/tymondesigns/jwt-auth
并在在 AuthController 中,
您可以像这样修改 expires_in 属性:
Use this jwt package: https://github.com/tymondesigns/jwt-auth
And In The AuthController ,
You can modifiy the expires_in property just like this: