How should I use the Java 8 date classes with io.jsonwebtoken?

Paras Source

I have a Spring Boot JSON Api and for authentication I'm using JWT tokens. To generate JWT toke I'm using io.jsonwebtoken library. The whole application uses java.time.ZonedDateTime for Date fields, however the io.jsonwebtoken relies on the old java.util.Date which creates is creating a lot of issues. Any suggestion on what can be the easiest way to make them compatible, provided I keep wanting to use the new Date classes provided by Java 8.



answered 4 weeks ago benjamin c #1

As far i know io.jsonwebtoken does not support for new java.time classes, you can convert java.time.ZonedDateTime to java.util.Date and use them in date fields.


comments powered by Disqus