From 965fdad8b1de136bb133632162ff475c9d2127e1 Mon Sep 17 00:00:00 2001 From: Balu Babu Date: Wed, 8 Feb 2023 14:20:51 +0530 Subject: [PATCH] refactor: refactored gql-auth-guard to work for websocket based subscriptions --- packages/hoppscotch-backend/src/guards/gql-auth.guard.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/hoppscotch-backend/src/guards/gql-auth.guard.ts b/packages/hoppscotch-backend/src/guards/gql-auth.guard.ts index 3ae7ade72..6d9952995 100644 --- a/packages/hoppscotch-backend/src/guards/gql-auth.guard.ts +++ b/packages/hoppscotch-backend/src/guards/gql-auth.guard.ts @@ -6,6 +6,7 @@ import { AuthGuard } from '@nestjs/passport'; export class GqlAuthGuard extends AuthGuard('jwt') { getRequest(context: ExecutionContext) { const ctx = GqlExecutionContext.create(context); - return ctx.getContext().req; + const { req, headers } = ctx.getContext(); + return headers ? headers : req; } }