refactor: refactored gql-auth-guard to work for websocket based subscriptions
This commit is contained in:
@@ -6,6 +6,7 @@ import { AuthGuard } from '@nestjs/passport';
|
|||||||
export class GqlAuthGuard extends AuthGuard('jwt') {
|
export class GqlAuthGuard extends AuthGuard('jwt') {
|
||||||
getRequest(context: ExecutionContext) {
|
getRequest(context: ExecutionContext) {
|
||||||
const ctx = GqlExecutionContext.create(context);
|
const ctx = GqlExecutionContext.create(context);
|
||||||
return ctx.getContext().req;
|
const { req, headers } = ctx.getContext();
|
||||||
|
return headers ? headers : req;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user