Re:JWT is Awesome
by mwilliaams on Tuesday February 18, 2020 @08:48PM
(#22362401)
I did exactly this on the last implementation of JWT I did. Common actions wouldn’t hit the database if the token was less than an hour old, but actions like changing email address or password would always check the database.
Re:JWT is Awesome
by user5994461 on Wednesday February 19, 2020 @04:18PM
(#22370182)
This just made me realize. There is an even simpler way to achieve the same result without a database.
The token includes the time when it was created (iat attribute) so critical actions could check that the token is less than 3 minutes old.
Re:JWT is Awesome
by mwilliaams on Wednesday February 19, 2020 @04:37PM
(#22370363)
Yeah that’s what I did, with iat info. But I did that for every request, and critical actions always hit the db.
It isn’t all or nothing.