From ca2719bdca1ba810c387858a82b72d63c1e702ce Mon Sep 17 00:00:00 2001 From: "jung hyun, ko" Date: Sat, 9 Aug 2025 13:46:28 +0900 Subject: [PATCH] Changed basePath in auth.ts to match the official documentation("/api/auth") (Next.js v15.4.6) The official documentation (https://authjs.dev/guides/configuring-github) suggests setting the Callback URL to "http://localhost:3000/api/auth/callback/github", but the official example (https://github.com/nextauthjs/next-auth-example) doesn't include an api folder. need to change the basePath in auth.ts to match the documentation. Also, when running the prettier command, if the path contains "[...]", the following error occurs: [error] No files matching the pattern were found: "'apps/examples/nextjs/app/api/auth/[...nextauth]/route.ts'". So, I added a path exception to lefthook.yml. This doesn't seem to be the best solution. There may be another way. --- apps/examples/nextjs/app/{ => api}/auth/[...nextauth]/route.ts | 0 apps/examples/nextjs/auth.ts | 2 +- lefthook.yml | 2 ++ 3 files changed, 3 insertions(+), 1 deletion(-) rename apps/examples/nextjs/app/{ => api}/auth/[...nextauth]/route.ts (100%) diff --git a/apps/examples/nextjs/app/auth/[...nextauth]/route.ts b/apps/examples/nextjs/app/api/auth/[...nextauth]/route.ts similarity index 100% rename from apps/examples/nextjs/app/auth/[...nextauth]/route.ts rename to apps/examples/nextjs/app/api/auth/[...nextauth]/route.ts diff --git a/apps/examples/nextjs/auth.ts b/apps/examples/nextjs/auth.ts index fa7c049ea3..ab83175409 100644 --- a/apps/examples/nextjs/auth.ts +++ b/apps/examples/nextjs/auth.ts @@ -100,7 +100,7 @@ export const { handlers, auth, signIn, signOut } = NextAuth({ WorkOS({ connection: process.env.AUTH_WORKOS_CONNECTION! }), Zoom, ], - basePath: "/auth", + basePath: "/api/auth", session: { strategy: "jwt" }, callbacks: { authorized({ request, auth }) { diff --git a/lefthook.yml b/lefthook.yml index b04410518c..05b9c66d45 100644 --- a/lefthook.yml +++ b/lefthook.yml @@ -3,4 +3,6 @@ pre-commit: commands: format: run: pnpm prettier --cache --write {staged_files} + exclude: + - apps/examples/nextjs/app/api/auth/* stage_fixed: true