Closed affanshahid closed 5 years ago
If I'm right, you shouldn't store jwt token in db. You should save user id or something different within token for verification purposes.
But if you want you can use passReqToCallback
option and get your token from request headers req.headers.authorization
I agree with @zvs001. JWT’s are supposed to be stateless, so storing the JWT in the database defeats the point. I don’t think it is worth the extra complexity to support this unusual use case when you can already extract the unparsed token from the request if you really need it.
How do I access the token itself in the verify callback?
I associate tokens with users in the DB, so need it for verification purposes.