From 5de48bbda6a8ba3a9d255ec450d3f52d2ba81e9f Mon Sep 17 00:00:00 2001 From: 0xzio Date: Tue, 19 Nov 2024 12:55:43 +0800 Subject: [PATCH] chore: add logs for auth --- app/api/auth/[...nextauth]/route.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/api/auth/[...nextauth]/route.ts b/app/api/auth/[...nextauth]/route.ts index 286bbda7..5d08a051 100644 --- a/app/api/auth/[...nextauth]/route.ts +++ b/app/api/auth/[...nextauth]/route.ts @@ -43,10 +43,19 @@ async function handler(req: Request, res: Response) { const host = req.headers.get('host') + console.log( + '========host:', + host, + 'process.env.NEXTAUTH_URL:', + process.env.NEXTAUTH_URL, + ) + process.env.NEXTAUTH_URL = process.env.NEXTAUTH_URL || (/localhost/.test(host || '') ? `http://${host}` : `https://${host}`) + console.log('===========process.env.NEXTAUTH_URL:', process.env.NEXTAUTH_URL) + return await NextAuth(req as any, res as any, { secret: nextAuthSecret, providers: [