I am developing a REST API but JWT's looks wrong to me. We all calling them as "stateless tokens" but actually they brings a lot of problems.
We all say, they should not be stored in a database or memory cache solutions. But there are 3 core conditions about that API for me, please enlighten me about how can I implemented them without accessing / store them in DB.
- When user changes his password, the token should be invalidated immediately.
- When user log-out, the token should be invalidated immediately.
- The architecture should be available to scale horizontally easily. I don't want a trouble.
If we do database/cache lookups in each request for those conditions, JWT is a totally useless solution, Isn't it?