fix: cron api key checks (#17730)

This commit is contained in:
Omar López
2024-11-19 00:18:53 +00:00
committed by GitHub
parent 32aaa26bf1
commit 03e2c6278d
+2 -2
View File
@@ -7,8 +7,8 @@ import { SelectedCalendarRepository } from "@calcom/lib/server/repository/select
import { CalendarCache } from "../calendar-cache";
const validateRequest = (req: NextApiRequest) => {
const apiKey = String(req.query.apiKey) || req.headers.authorization;
if (!apiKey || ![process.env.CRON_API_KEY, `Bearer ${process.env.CRON_SECRET}`].includes(apiKey)) {
const apiKey = req.headers.authorization || req.query.apiKey;
if (![process.env.CRON_API_KEY, `Bearer ${process.env.CRON_SECRET}`].includes(`${apiKey}`)) {
throw new HttpError({ statusCode: 401, message: "Unauthorized" });
}
};