From c9c810239b13fb32a70da4f653d92dcceea34974 Mon Sep 17 00:00:00 2001 From: "SK\\ssssk" Date: Thu, 1 Aug 2024 01:19:15 +0900 Subject: [PATCH] =?UTF-8?q?=EC=B9=B4=EC=B9=B4=EC=98=A4=20=EB=A1=9C?= =?UTF-8?q?=EA=B7=B8=EC=9D=B8=20=ED=95=A0=20=EB=96=84=20=ED=9D=B0=20?= =?UTF-8?q?=EB=B0=B0=EA=B2=BD=EC=97=90=20=EC=95=84=EB=AC=B4=EB=9F=B0=20?= =?UTF-8?q?=EC=9E=91=EB=8F=99=20=EC=95=88=ED=95=98=EB=8A=94=20=EB=AC=B8?= =?UTF-8?q?=EC=A0=9C=20=EB=B0=9C=EC=83=9D=EC=97=90=20=EB=8C=80=ED=95=9C=20?= =?UTF-8?q?=EC=9E=84=EC=8B=9C=20=EC=A1=B0=EC=B9=98(=EB=AC=B8=EC=A0=9C=20?= =?UTF-8?q?=EC=9B=90=EC=9D=B8=EC=9D=84=20=ED=8C=8C=EC=95=85=20=EB=AA=BB?= =?UTF-8?q?=ED=95=A8)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/api/auth/kakao/route.ts | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/app/api/auth/kakao/route.ts b/src/app/api/auth/kakao/route.ts index f9c150a1..7e839be1 100644 --- a/src/app/api/auth/kakao/route.ts +++ b/src/app/api/auth/kakao/route.ts @@ -1,19 +1,16 @@ import { NextResponse } from "next/server"; export function GET() { + try { const clientId = process.env.KAKAO_REST_API_KEY; const redirectUri = process.env.NEXT_PUBLIC_KAKAO_REDIRECT_URL; + const timestamp = new Date().toISOString(); // Get the current timestamp in ISO format if (!clientId || !redirectUri) { - console.error("Environment variables are not set correctly"); - return new Response("Environment variables are not set correctly", { - status: 500, - }); + return NextResponse.redirect("/auth/signin"); } - const kakaoAuthUrl = `https://kauth.kakao.com/oauth/authorize?response_type=code&client_id=${clientId}&redirect_uri=${redirectUri}`; - - try { + const kakaoAuthUrl = `https://kauth.kakao.com/oauth/authorize?response_type=code&client_id=${clientId}&redirect_uri=${redirectUri}×tamp=${timestamp}`; return NextResponse.redirect(kakaoAuthUrl); } catch (error) { return NextResponse.redirect("/auth/signin");