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

Co-authored-by: Rajiv Sahal <[email protected]>
This commit is contained in:
Jevtić NenadandRajiv Sahal authored and GitHub committed 2024-09-30 18:56:17 -03:00
1 parent 9375efffe3
commit 5b5f7c1c48
1 file changed
+3 -7
@@ -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) {