fix(auth): remove self-referential pages.signIn config

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) <noreply@anthropic.com>
This commit is contained in:
2026-05-15 08:15:41 -07:00
co-authored by Claude Opus 4.7
parent 3de1701175
commit 7ab6dfe6f6
+3 -2
View File
@@ -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.