From 27540b09ce950f215475ddffe15dd8f9b3877f5b Mon Sep 17 00:00:00 2001 From: Agusti Fernandez Pardo Date: Mon, 16 May 2022 17:34:13 +0200 Subject: [PATCH] fix: remove hardcoded redirect in signin url email verification (#2764) Co-authored-by: Agusti Fernandez Pardo --- apps/web/pages/api/auth/[...nextauth].tsx | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/apps/web/pages/api/auth/[...nextauth].tsx b/apps/web/pages/api/auth/[...nextauth].tsx index 68aec2507a..574951f70e 100644 --- a/apps/web/pages/api/auth/[...nextauth].tsx +++ b/apps/web/pages/api/auth/[...nextauth].tsx @@ -165,9 +165,6 @@ if (true) { maxAge: 10 * 60 * 60, // Magic links are valid for 10 min only // Here we setup the sendVerificationRequest that calls the email template with the identifier (email) and token to verify. sendVerificationRequest: ({ identifier, url }) => { - // Here we add /new endpoint to the callback URL by adding it before &token=. - // This is not elegant but it works. We should probably use a different approach when we can. - url = url.includes("/auth/new") ? url : url.replace("&token", "/auth/new&token"); const emailFile = readFileSync(path.join(emailsDir, "confirm-email.html"), { encoding: "utf8", }); @@ -198,7 +195,7 @@ export default NextAuth({ signIn: "/auth/login", signOut: "/auth/logout", error: "/auth/error", // Error code passed in query string as ?error= - newUser: "/auth/new", // New users will be directed here on first sign in (leave the property out if not of interest) + // newUser: "/auth/new", // New users will be directed here on first sign in (leave the property out if not of interest) }, providers, callbacks: {