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.
我正在使用JsonWebToken为用户进行身份验证。当用户登录时,我为用户创建一个令牌。然后用户更新他们的信息,我为用户创建一个新令牌。如何为以前的令牌设置无效?例如:将过期日期更改为现在或其他......
要使之前的令牌无效,您可能需要使用数据库或数据存储(如 Redis),其中可能包含列入黑名单的令牌。然后可以根据此验证检查每个请求的 JWT。