Skip to content

Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia

refactor: refactored gql-auth-guard to work for websocket based subscriptions

Balu Babu965fdad8b1de
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;
}
}