什么是刷新令牌授权程序
我目前正在与Expressjs一起从事一个项目。对于用户授权,我使用JWT令牌,但直到现在只有访问令牌,因为我只是不理解它们与真实示例。因此,有人可以向我解释当某人登录他的帐户时,授权是什么。
FE:
- 刷新和访问令牌会产生的
- 令牌被存储在数据库等
。
I'm currently working on a project with expressjs. For user authorization I use JWT tokens but until now only access tokens, because I just don't understand them together with a real example. So can somebody explain to me what the steps are the authorization goes through when someone logs into his account.
f.E.:
- Refresh and Access Tokens get generated
- Token gets stored into database etc.
Thank you in advance and have a great day
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可能想考虑的扩展:
可以使用不同的令人耳目一新的模式。为了
例如,您可以每次检查JWT的到期
服务器收到请求。如果JWT即将到期,请发行新鲜
JWT。
如果将到期设置为30分钟,并且用户在第15分钟标记处注销,那么JWT在技术上仍然可以使用该端点再访问受保护的端点15分钟。
Extensions that you might want to think about:
There are different refreshing patterns that can be used. For
example, you can check the expiry of the JWT every time that your
server receives a request. If JWT is expiring soon, issue a fresh
JWT.
If you set the expiry as 30 minutes and a user logs out at the 15th minute mark, that JWT can technically still be used to access protected endpoints for another 15 minutes.