Skip to content

Commit fd73997

Browse files
committed
Log warnings on verification token issues
1 parent 54f351c commit fd73997

1 file changed

Lines changed: 14 additions & 2 deletions

File tree

packages/database/auth/drizzle-adapter.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,10 +337,22 @@ export function DrizzleAdapter(db: MySql2Database): Adapter {
337337
.where(eq(verificationTokens.token, token))
338338
.limit(1);
339339
const row = rows[0];
340-
if (!row) return null;
340+
if (!row) {
341+
console.warn(
342+
"[useVerificationToken] No token found for hash",
343+
{ identifier, tokenPrefix: token.slice(0, 8) },
344+
);
345+
return null;
346+
}
341347
const normalizedIdentifier = identifier?.toLowerCase() ?? "";
342348
const storedIdentifier = row.identifier?.toLowerCase() ?? "";
343-
if (normalizedIdentifier !== storedIdentifier) return null;
349+
if (normalizedIdentifier !== storedIdentifier) {
350+
console.warn(
351+
"[useVerificationToken] Identifier mismatch",
352+
{ expected: normalizedIdentifier, stored: storedIdentifier },
353+
);
354+
return null;
355+
}
344356
await db
345357
.delete(verificationTokens)
346358
.where(

0 commit comments

Comments
 (0)