chore: changed jwt stratergy to use cookies instead of signedCookies

This commit is contained in:
Balu Babu
2023-02-08 14:24:16 +05:30
parent 9c64721bf0
commit 505adea0ef

View File

@@ -22,7 +22,7 @@ export class JwtStrategy extends PassportStrategy(Strategy, 'jwt') {
super({
jwtFromRequest: ExtractJwt.fromExtractors([
(request: Request) => {
const ATCookie = request.signedCookies['access_token'];
const ATCookie = request.cookies['access_token'];
if (!ATCookie) {
throw new ForbiddenException(COOKIES_NOT_FOUND);
}
@@ -37,6 +37,8 @@ export class JwtStrategy extends PassportStrategy(Strategy, 'jwt') {
if (!payload) throw new ForbiddenException(INVALID_ACCESS_TOKEN);
const user = await this.usersService.findUserById(payload.sub);
console.log('user', user);
if (O.isNone(user)) {
throw new UnauthorizedException(USER_NOT_FOUND);
}