From bc145e75fd9fda90ec217d4625054589acc754c2 Mon Sep 17 00:00:00 2001 From: Hyesu Date: Fri, 3 Jan 2025 11:50:10 +0900 Subject: [PATCH] =?UTF-8?q?hotfix:=20=EC=95=A0=ED=94=8C=20=ED=86=A0?= =?UTF-8?q?=ED=81=B0=20=EC=83=9D=EC=84=B1=20=EC=A0=95=EC=83=81=ED=99=94=20?= =?UTF-8?q?=ED=85=8C=EC=8A=A4=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/auth/[...nextauth]/route.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/api/auth/[...nextauth]/route.ts b/app/api/auth/[...nextauth]/route.ts index b1b087f6..fe27b968 100644 --- a/app/api/auth/[...nextauth]/route.ts +++ b/app/api/auth/[...nextauth]/route.ts @@ -7,7 +7,7 @@ import { SignJWT } from 'jose'; // 애플 토큰 생성 함수 const getAppleToken = async () => { const key = `-----BEGIN PRIVATE KEY-----\n${process.env.APPLE_PRIVATE_KEY}\n-----END PRIVATE KEY-----`; - return await new SignJWT({}) + const token = await new SignJWT({}) .setAudience('https://appleid.apple.com') .setIssuer(process.env.APPLE_TEAM_ID!) .setIssuedAt(new Date().getTime() / 1000) @@ -18,7 +18,11 @@ const getAppleToken = async () => { kid: process.env.APPLE_KEY_ID, }) .sign(createPrivateKey(key)); + + console.log('Generated Apple Client Secret:', token); // 토큰 로그 출력 + return token; }; + // Apple 토큰을 미리 생성 const appleClientSecret = await getAppleToken(); @@ -45,7 +49,7 @@ const authOptions: NextAuthOptions = { scope: 'name email', response_mode: 'form_post', response_type: 'code', - redirect_uri: '/api/auth/callback/apple', + redirect_uri: process.env.NEXTAUTH_URL + '/api/auth/callback/apple', }, }, profile(profile) {