JWT token is generated and returned only on the response of the login request. On rest of the (action) calls, the JWT token is only sent to the backend, there is no new token received and updates at the client end. On logout, the token on the client end is cleared.
The race condition occurs only if between the login and logout requests then.
Ideally you cannot delete a JWT token since we do not store it on backend. Deletion is truly only when it expires. So a modified version of this model will maintain a list of all the logged out unexpired tokens in the backend for improved security. This can also help in avoiding the said race condition.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…