Skip to content

Scheduling infrastructure for absolutely everyone.

fix: Fix conditional check for oAuth client id (#16809)

Jevtić Nenad5b5f7c1c48dd
diff --git a/apps/api/v2/src/modules/webhooks/guards/is-oauth-client-webhook-guard.ts b/apps/api/v2/src/modules/webhooks/guards/is-oauth-client-webhook-guard.ts
index 0bb2da13684..543f4fef252 100644
--- a/apps/api/v2/src/modules/webhooks/guards/is-oauth-client-webhook-guard.ts
+++ b/apps/api/v2/src/modules/webhooks/guards/is-oauth-client-webhook-guard.ts
@@ -3,12 +3,12 @@ import { OAuthClientRepository } from "@/modules/oauth-clients/oauth-client.repo
import { UsersService } from "@/modules/users/services/users.service";
import { WebhooksService } from "@/modules/webhooks/services/webhooks.service";
import {
+ BadRequestException,
CanActivate,
ExecutionContext,
+ ForbiddenException,
Injectable,
NotFoundException,
- ForbiddenException,
- BadRequestException,
} from "@nestjs/common";
import { Request } from "express";
@@ -39,14 +39,10 @@ export class IsOAuthClientWebhookGuard implements CanActivate {
throw new BadRequestException("webhookId parameter not specified in the request");
}
- if (!webhookId) {
+ if (!oAuthClientId) {
throw new BadRequestException("oAuthClientId parameter not specified in the request");
}
- if (!user || !webhookId || !oAuthClientId) {
- return false;
- }
-
const oAuthClient = await this.oAuthClientRepository.getOAuthClient(oAuthClientId);
if (!oAuthClient) {