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");