How to save JWT in Redis?

Asked by At

I'm creating a Spring Boot project with Java 8 and MongoDB. For session management I'm using a JWT token. I've searched many ways to invalidate the JWT token on logout. I read that it's possible to blacklist the token in Redis and validate towards it. How to store/save JWT in Redis? On Redis server restart saved JWT token data will be lost, right? How to handle it?

1 Answers

Ryoma On

I think you should to look more about docs. And I can tell you:

  • you have many ways to store in redis
  • redis support persistent data(But I don't suggest persistent data, you should use redis in cache not storage)