Wednesday 31 July 2019

Can I authorize JWT cookies in NestJS?

Hello, I am currently writing a backend server using NestJS. I have a JWT passport strategy that I use with AuthGuard to validate the JWTs. I was wondering if it is possible to extract the cookie containing my JWT token and pass it into jwtFromRequest in the super() method in my JwtStrategy class that extends PassportStrategy. Currently it is using ExtractJwt.fromAuthHeaderAsBearerToken() to get the tokens from the headers. Sorry for a noobish question. I did not know how to better phrase this.The current logic:1. User signs in -> server signs payload and returns it in a res.cookie()2. User requests the server -> server will check the JWT in client's cookies and use passport-jwt to check the validity

Submitted July 31, 2019 at 08:49PM by recycled_bin

No comments:

Post a Comment