From 7ab6dfe6f61a1431471bb0358ee86cd8ee3e626f Mon Sep 17 00:00:00 2001 From: jknapp Date: Fri, 15 May 2026 08:15:41 -0700 Subject: [PATCH] fix(auth): remove self-referential pages.signIn config MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit pages.signIn is meant to point at a CUSTOM sign-in page. Setting it to '/api/auth/signin' — Auth.js's own built-in endpoint — makes Auth.js redirect there whenever it wants the sign-in page, which is the same endpoint, producing ERR_TOO_MANY_REDIRECTS in browsers. Omitting the setting falls back to Auth.js's default sign-in handler, which renders the provider-picker HTML at /api/auth/signin instead of redirecting. Co-Authored-By: Claude Opus 4.7 (1M context) --- apps/web/auth.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/web/auth.ts b/apps/web/auth.ts index c5a6a74..faee7f9 100644 --- a/apps/web/auth.ts +++ b/apps/web/auth.ts @@ -21,8 +21,9 @@ export const { auth, handlers, signIn, signOut } = NextAuth({ ], secret: env().NEXTAUTH_SECRET, session: { strategy: "jwt" }, - // Sign-in page is the default Auth.js form; can be customized later. - pages: { signIn: "/api/auth/signin" }, + // No custom `pages.signIn`: Auth.js serves its default provider-picker UI + // at /api/auth/signin. Setting it to that exact path causes a redirect + // loop because Auth.js redirects to the configured page → which is itself. callbacks: { async jwt({ token, account, profile }) { // On first call after sign-in, `account` + `profile` are populated.