Skip to content

Scheduling infrastructure for absolutely everyone.

make verifyApiKey not apply in docs

Agusti Fernandez Pardo09d8b48cccf3
diff --git a/lib/helpers/verifyApiKey.ts b/lib/helpers/verifyApiKey.ts
index 6fe33c6ad3e..998f783c778 100644
--- a/lib/helpers/verifyApiKey.ts
+++ b/lib/helpers/verifyApiKey.ts
@@ -13,11 +13,12 @@ const today = new Date();
// This verifies the API key and sets the user if it is valid.
export const verifyApiKey: NextMiddleware = async (req, res, next) => {
+ const pathIsDocs = req.url?.startsWith("/docs");
+ if (pathIsDocs) await next()
if (!req.query.apiKey) res.status(401).json({ message: "No API key provided" });
const strippedApiKey = `${req.query.apiKey}`.replace(process.env.API_KEY_PREFIX || "cal_", "");
const hashedKey = hashAPIKey(strippedApiKey);
-
await prisma.apiKey
.findUnique({ where: { hashedKey } })
.then(async (apiKey) => {