Skip to content

Scheduling infrastructure for absolutely everyone.

fix: encode JWT in 2FA redirect URL to prevent invalid header error (#25331)

Tamal Chakrabortya3c0d06c1317
diff --git a/packages/features/auth/lib/next-auth-options.ts b/packages/features/auth/lib/next-auth-options.ts
index fedc3e958a3..774b88e59b8 100644
--- a/packages/features/auth/lib/next-auth-options.ts
+++ b/packages/features/auth/lib/next-auth-options.ts
@@ -97,7 +97,7 @@ const usernameSlug = (username: string) => `${slugify(username)}-${randomString(
const getDomainFromEmail = (email: string): string => email.split("@")[1];
const loginWithTotp = async (email: string) =>
- `/auth/login?totp=${await (await import("./signJwt")).default({ email })}`;
+ `/auth/login?totp=${encodeURIComponent(await (await import("./signJwt")).default({ email }))}`;
type UserTeams = {
teams: (Membership & {