Skip to content

Commit

Permalink
Merge pull request #163 from TripInfoWeb/dev_auth
Browse files Browse the repository at this point in the history
카카오 로그인 할 떄 흰 배경에 아무런 작동 안하는 문제 발생에 대한 임시 조치(문제 원인을 파악 못함)
  • Loading branch information
ssssksss authored Jul 31, 2024
2 parents 31e6321 + c9c8102 commit 762a254
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/app/api/auth/kakao/route.ts
Original file line number Diff line number Diff line change
@@ -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}&timestamp=${timestamp}`;
return NextResponse.redirect(kakaoAuthUrl);
} catch (error) {
return NextResponse.redirect("/auth/signin");
Expand Down

0 comments on commit 762a254

Please sign in to comment.