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:
+3
-2
@@ -21,8 +21,9 @@ export const { auth, handlers, signIn, signOut } = NextAuth({
|
|||||||
],
|
],
|
||||||
secret: env().NEXTAUTH_SECRET,
|
secret: env().NEXTAUTH_SECRET,
|
||||||
session: { strategy: "jwt" },
|
session: { strategy: "jwt" },
|
||||||
// Sign-in page is the default Auth.js form; can be customized later.
|
// No custom `pages.signIn`: Auth.js serves its default provider-picker UI
|
||||||
pages: { signIn: "/api/auth/signin" },
|
// 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: {
|
callbacks: {
|
||||||
async jwt({ token, account, profile }) {
|
async jwt({ token, account, profile }) {
|
||||||
// On first call after sign-in, `account` + `profile` are populated.
|
// On first call after sign-in, `account` + `profile` are populated.
|
||||||
|
|||||||
Reference in New Issue
Block a user