Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions necchange/src/app/api/auth/[...nextauth]/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,17 @@ const handler = async (req, context) => {
return new Response(null, { status: 200 });
}

// Macete para rejeitar emails vindos do postmaster,
// por algum motivo o postmaster insiste em chamar esta api com o arugmento "callbackUrl" que já não é utilizado,
// mas que no entanto invalida o token de verificaçao.
const url = new URL(req.url);
const hasCallbackUrl = url.searchParams.has("callbackUrl");

if (url.pathname === "/api/auth/callback/email" && hasCallbackUrl) {
console.warn("Blocked automated request with callbackUrl:", url.searchParams.get("callbackUrl"));
return new Response(null, { status: 200 });
}

return await NextAuth(req, context, authOptions);
};

Expand Down