Skip to content

Commit

Permalink
Merge pull request #111 from TripInfoWeb/dev_auth
Browse files Browse the repository at this point in the history
CSR에서 env 값을 읽어오지 못하는 것으로 추측되어process.env.NEXT_PUBLIC 방식으로 변경
  • Loading branch information
ssssksss authored Jul 9, 2024
2 parents e9b51bd + e7a6d28 commit ad6acd8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/app/api/auth/kakao/route.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { NextResponse } from "next/server";

export function GET() {
const kakaoAuthUrl = `https://kauth.kakao.com/oauth/authorize?response_type=code&client_id=${process.env.NODE_ENV === "development" ? process.env.NEXT_PUBLIC_KAKAO_REST_API_KEY : process.env.KAKAO_REST_API_KEY}&redirect_uri=${process.env.NODE_ENV === "development" ? process.env.NEXT_PUBLIC_KAKAO_REDIRECT_URI : process.env.KAKAO_REDIRECT_URI}`;
const kakaoAuthUrl = `https://kauth.kakao.com/oauth/authorize?response_type=code&client_id=${process.env.NODE_ENV === "development" ? process.env.NEXT_PUBLIC_KAKAO_REST_API_KEY : process.env.KAKAO_REST_API_KEY}&redirect_uri=${process.env.NEXT_PUBLIC_KAKAO_REDIRECT_URI}`;
return NextResponse.redirect(kakaoAuthUrl);
}
2 changes: 1 addition & 1 deletion src/containers/auth/AuthKaKaoContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const AuthKaKaoContainer = () => {
const kakaoLogin = async () => {
try {
const response = await fetch(
`${process.env.NODE_ENV === "development" ? process.env.NEXT_PUBLIC_BACKEND_URL : process.env.BACKEND_URL}/api/auth/oauth2/login?type=kakao&redirectUrl=${process.env.NODE_ENV === "development" ? process.env.NEXT_PUBLIC_KAKAO_REDIRECT_URI : process.env.KAKAO_REDIRECT_URI}&code=${_queryStringObject?.code}`,
`${process.env.NEXT_PUBLIC_BACKEND_URL}/api/auth/oauth2/login?type=kakao&redirectUrl=${process.env.NEXT_PUBLIC_KAKAO_REDIRECT_URI}&code=${_queryStringObject?.code}`,
{
method: "GET",
headers: {
Expand Down

0 comments on commit ad6acd8

Please sign in to comment.