From 80c6f600dbe14360838e9e932a0944249235cdec Mon Sep 17 00:00:00 2001 From: Balu Babu Date: Fri, 3 Mar 2023 15:52:26 +0530 Subject: [PATCH] hotfix: refresh token cookie migration (HBE-167) (#31) * chore: removed signed cookies from refresh token strategy * chore: removed signed cookies from refresh RTCookie decorator --- .../hoppscotch-backend/src/auth/strategies/rt-jwt.strategy.ts | 2 +- .../hoppscotch-backend/src/decorators/rt-cookie.decorator.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/hoppscotch-backend/src/auth/strategies/rt-jwt.strategy.ts b/packages/hoppscotch-backend/src/auth/strategies/rt-jwt.strategy.ts index ae6e96c3c..669fbb170 100644 --- a/packages/hoppscotch-backend/src/auth/strategies/rt-jwt.strategy.ts +++ b/packages/hoppscotch-backend/src/auth/strategies/rt-jwt.strategy.ts @@ -21,7 +21,7 @@ export class RTJwtStrategy extends PassportStrategy(Strategy, 'jwt-refresh') { super({ jwtFromRequest: ExtractJwt.fromExtractors([ (request: Request) => { - const RTCookie = request.signedCookies['refresh_token']; + const RTCookie = request.cookies['refresh_token']; if (!RTCookie) { throw new ForbiddenException(COOKIES_NOT_FOUND); } diff --git a/packages/hoppscotch-backend/src/decorators/rt-cookie.decorator.ts b/packages/hoppscotch-backend/src/decorators/rt-cookie.decorator.ts index 97f503f71..a0d12ebbf 100644 --- a/packages/hoppscotch-backend/src/decorators/rt-cookie.decorator.ts +++ b/packages/hoppscotch-backend/src/decorators/rt-cookie.decorator.ts @@ -7,6 +7,6 @@ import { GqlExecutionContext } from '@nestjs/graphql'; export const RTCookie = createParamDecorator( (data: unknown, context: ExecutionContext) => { const ctx = GqlExecutionContext.create(context); - return ctx.getContext().req.signedCookies['refresh_token']; + return ctx.getContext().req.cookies['refresh_token']; }, );