Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
JWT 的最佳到期时间是什么,这样用户除非单击注销,否则永远不会被注销?请注意,node.js 服务器可能会一直启动并运行
这不是正确的做法。永远不要让你的 jwt 有太多的过期时间。如果您的令牌被盗,则攻击者将获得更多访问权限,因为此令牌永不过期。JWT 是基于私钥的匹配。在秘密没有改变之前,您的来源可以通过该密钥访问。
改为使用refresh_token。这将有过期没有过期时间。用你的refresh_token来获得新的access_token. 您也可以根据设备使 refresh_token 过期。
refresh_token
access_token