Skip to content

Conversation

@sgoldenbird
Copy link
Contributor

@sgoldenbird sgoldenbird commented Aug 4, 2025

👻 관련 이슈 번호

  • none

👻 요약

  • 기존에 구현된 카카오 OAuth 인증 흐름을 더욱 견고하게 만들고, 애플리케이션의 전역 에러 페이지 UI를 개선

👻 주요 변경 사항

👻 체크리스트

  • Assignees에 본인을 등록했나요?
  • 라벨을 사이드 탭에서 등록했나요?
  • PR은 사이드 탭 Projects를 등록 하지마세요.
  • PR은 Milestone을 등록 하지마세요.
  • PR을 보내는 브랜치가 올바른지 확인했나요?
  • 팀원들이 리뷰하기 쉽도록 설명을 자세하게 작성했나요?
  • 변경사항을 충분히 테스트 했나요?
  • 컨벤션에 맞게 구현했나요?

📷 UI 변경 사항

👻 문제 사항

👻 논의 사항

👻 기타 참고 사항

Summary by CodeRabbit

  • 신규 기능

    • 카카오 OAuth 로그인 및 회원가입을 위한 API 경로와 클라이언트 전환 페이지가 추가되었습니다.
    • 카카오 인증 흐름에서 중간 안내 및 에러 메시지를 보여주는 전환 컴포넌트가 도입되었습니다.
  • 기능 개선

    • OAuth 컴포넌트가 단순화되어, 로그인/회원가입 구분 없이 하나의 버튼으로 카카오 인증을 시작할 수 있습니다.
    • 인증 관련 페이지에서 OAuth 컴포넌트 사용 방식이 일관되게 변경되었습니다.
  • 버그 수정

    • 미들웨어의 토큰 갱신 및 쿠키 처리 로직이 개선되었습니다.
  • 문서 및 설정

    • .gitignore에 local-assets/가 추가되어 해당 폴더가 무시됩니다.
    • Vercel 서버리스 함수 실행 시간 설정이 추가되었습니다.
    • 이미지 최적화 관련 설정이 주석 처리되었습니다.

@coderabbitai
Copy link

coderabbitai bot commented Aug 4, 2025

Walkthrough

카카오 OAuth 인증 및 회원가입 플로우를 위한 새로운 API 라우트와 클라이언트 컴포넌트가 추가되었습니다. OAuth 버튼 컴포넌트가 단순화되었고, 인증 전환 페이지가 도입되었습니다. 미들웨어, 환경설정, .gitignore 등에도 소규모 보완이 있었습니다.

Changes

Cohort / File(s) Change Summary
카카오 OAuth API 라우트 추가
src/app/api/auth/kakao/signin/route.ts, src/app/api/auth/kakao/signup/route.ts
카카오 OAuth 로그인 및 회원가입을 위한 Next.js API 라우트가 새로 도입되었습니다. 인증 코드 처리, 백엔드 연동, 쿠키 설정, 상태별 리다이렉트 및 에러 핸들링 로직이 포함되어 있습니다.
카카오 인증 전환 클라이언트 컴포넌트
src/domain/Auth/components/KakaoTransition.tsx, src/app/(auth)/kakao/transition/page.tsx
인증/회원가입 전환 상황에서 사용자에게 안내 메시지를 제공하는 KakaoTransition 컴포넌트 및 해당 페이지가 추가되었습니다. 동적 import 및 Suspense 로딩이 적용되었습니다.
OAuth 버튼 컴포넌트 및 관련 페이지
src/domain/Auth/components/OAuth.tsx, src/app/(auth)/signin/page.tsx, src/app/(auth)/signup/page.tsx
OAuth 컴포넌트가 단순화되어 더 이상 pageType prop을 받지 않으며, 관련 로직이 제거되었습니다. 로그인/회원가입 페이지에서 prop 없이 호출됩니다.
미들웨어 리팩토링
src/middleware.ts
/api/etl 경로 예외처리 로직 제거 및 토큰 갱신 시 쿠키 설정을 유틸 함수로 일원화하였습니다.
환경설정 및 기타
.gitignore, next.config.ts, vercel.json
.gitignorelocal-assets/ 추가, Next.js 이미지 설정의 unoptimized: true 주석 처리, Vercel 함수 배포 설정 추가 등 환경설정 파일이 보완되었습니다.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Kakao
    participant NextAPI as Next.js API Route
    participant Backend

    User->>Kakao: OAuth 인증 요청 (인가 코드 요청)
    Kakao->>User: 인가 코드 전달 (redirect)
    User->>NextAPI: 인가 코드 포함 GET 요청
    NextAPI->>Backend: 인가 코드, redirect URI로 인증/회원가입 요청
    Backend-->>NextAPI: 인증/회원가입 결과 및 토큰
    alt 인증 성공
        NextAPI->>User: 쿠키 설정 후 메인 페이지로 리다이렉트
    else 회원가입 필요/에러
        NextAPI->>User: KakaoTransition 페이지 또는 에러 페이지로 리다이렉트
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested labels

feat

Suggested reviewers

  • Seon-K

Poem

🐇
카카오 바람 타고 로그인하네,
새 API 라우트가 길을 안내해.
전환 페이지에서 잠시 쉬었다가,
쿠키 품고 활동장으로 hop!
깔끔해진 버튼, 미들웨어도 정돈,
오늘도 토끼는 코드를 노래해!
☁️🥕


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ef429a5 and 251faed.

📒 Files selected for processing (1)
  • next.config.ts (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • next.config.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: vercel-preview
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/473/oauth-unified

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@sgoldenbird sgoldenbird self-assigned this Aug 4, 2025
@github-actions
Copy link

github-actions bot commented Aug 4, 2025

✅ Preview Deployment Ready!

🔗 Preview URL: https://roam-ready-6o43f60lg-yongmins-projects-bf5f7733.vercel.app
📝 Branch: feat/473/oauth-unified
💾 Commit: Feat/473/oauth unified
🕐 Deployed at:


This preview will be automatically updated on new commits.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

🧹 Nitpick comments (5)
src/domain/Auth/components/KakaoTransition.tsx (1)

43-46: OAuth URL 구성 로직 중앙화를 고려해보세요.

OAuth.tsx와 동일한 URL 구성 로직이 중복되고 있습니다. 공통 유틸리티 함수로 추출하면 유지보수성이 향상됩니다.

다음과 같은 유틸리티 함수 생성을 고려해보세요:

// utils/kakaoAuth.ts
export function buildKakaoAuthUrl(clientId: string, redirectUri: string): string {
  return `https://kauth.kakao.com/oauth/authorize?response_type=code&client_id=${clientId}&redirect_uri=${redirectUri}`;
}
src/domain/Auth/components/OAuth.tsx (1)

67-67: UI 텍스트 색상 일관성을 확인하세요.

KakaoTransition 컴포넌트에서는 text-gray-800을, 여기서는 text-gray-700을 사용하고 있습니다. 디자인 시스템의 일관성을 위해 통일하는 것을 고려해보세요.

src/app/api/auth/kakao/signin/route.ts (3)

82-84: 사용하지 않는 주석 코드 제거

주석 처리된 코드는 제거해주세요. 버전 관리 시스템에서 필요시 복원할 수 있습니다.

     const responseData = await handleOauthSignIn(code);
-    // const response = NextResponse.redirect(
-    //   new URL(ROUTES.ACTIVITIES.ROOT, request.url),
-    // );
     const response = new NextResponse(null, {

85-93: NextResponse.redirect 사용으로 코드 단순화

수동으로 302 응답을 구성하는 대신 NextResponse.redirect를 사용하면 코드가 더 간결해집니다.

-    const response = new NextResponse(null, {
-      status: 302,
-      statusText: 'Found',
-    });
-    response.headers.set(
-      'Location',
-      new URL(ROUTES.ACTIVITIES.ROOT, request.url).toString(),
-    );
+    const response = NextResponse.redirect(
+      new URL(ROUTES.ACTIVITIES.ROOT, request.url)
+    );

102-105: 에러 타입 처리 개선

타입 단언보다는 타입 가드를 사용하여 더 안전한 타입 처리를 할 수 있습니다.

+    interface ErrorWithStatus extends Error {
+      status?: number;
+    }
+
+    function hasStatus(error: unknown): error is ErrorWithStatus {
+      return error instanceof Error && 'status' in error;
+    }
+
     const errorStatus =
-      error instanceof Error && 'status' in error
-        ? (error as Error & { status: number }).status
-        : undefined;
+      hasStatus(error) ? error.status : undefined;
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9bcdf6d and ea0b23a.

📒 Files selected for processing (11)
  • src/app/(app)/error.tsx (1 hunks)
  • src/app/(auth)/kakao/transition/page.tsx (1 hunks)
  • src/app/(auth)/signin/page.tsx (1 hunks)
  • src/app/(auth)/signup/page.tsx (1 hunks)
  • src/app/api/auth/kakao/signin/route.ts (1 hunks)
  • src/app/api/auth/kakao/signup/route.ts (1 hunks)
  • src/app/api/test/error/route.ts (1 hunks)
  • src/app/error.tsx (1 hunks)
  • src/domain/Auth/components/KakaoTransition.tsx (1 hunks)
  • src/domain/Auth/components/OAuth.tsx (2 hunks)
  • src/middleware.ts (2 hunks)
🔇 Additional comments (10)
src/app/api/test/error/route.ts (1)

52-55: 409 에러 메시지 수정 확인

중복 필드가 ‘이메일’임을 명확히 해 주어 UX 일관성이 향상되었습니다. 기존 클라이언트 로직(특히 getErrorMessageByStatus)과도 잘 맞물리는지 한번 더 통합 테스트만 진행해 주세요.

src/app/error.tsx (1)

50-52: min-h-screen 추가로 레이아웃 안정성 확보

최상위 에러 페이지가 뷰포트 높이를 최소 확보하도록 개선되었습니다. 모바일-Safari에서 주소창 높이 변동 시 세로 스크롤이 과도하게 생기지 않는지만 QA 중 확인 부탁드립니다.

src/app/(app)/error.tsx (1)

49-51: 세그먼트 에러 페이지에도 동일한 높이 정책 적용 👍

GlobalError와 동일하게 min-h-screen을 부여해 시각적 일관성이 생겼습니다. 추가 작업 없습니다.

src/app/(auth)/signup/page.tsx (1)

47-48: OAuth 컴포넌트 pageType prop 제거 검증 완료
프로젝트 전반(회원가입·로그인 페이지, 테스트·스토리북 등)에서 더 이상 pageType prop 전달 흔적이 발견되지 않았습니다.

  • src/app/(auth)/signup/page.tsx: <OAuth /> 호출부 (prop 없음)
  • src/app/(auth)/signin/page.tsx: <OAuth /> 호출부 (prop 없음)
  • 테스트·스토리북 파일 전체: pageType prop 사용 없음

변경 사항을 안전하게 병합할 수 있습니다.

src/app/(auth)/signin/page.tsx (1)

48-49: OAuth 컴포넌트 호출부 정리 완료

pageType 삭제가 제대로 반영되었습니다. 위 signup 페이지와 동일하게 잔존 사용처 확인만 마무리하면 될 것 같습니다.

src/app/(auth)/kakao/transition/page.tsx (1)

1-16: 구현이 올바르게 되어 있습니다.

클라이언트 전용 컴포넌트에 대한 동적 임포트와 SSR 비활성화가 OAuth 플로우에 적합하며, Suspense 래퍼 사용도 좋습니다.

src/middleware.ts (2)

3-3: 쿠키 관리 로직 중앙화가 좋습니다.

setAuthCookies 유틸리티 함수 도입으로 코드 일관성이 향상되었습니다.


139-146: 토큰 갱신 로직 리팩토링이 적절합니다.

수동 쿠키 설정을 유틸리티 함수로 교체하여 코드 중복을 제거하고 유지보수성을 향상시켰습니다.

src/app/api/auth/kakao/signup/route.ts (2)

85-85: 랜덤 닉네임 생성 로직이 적절합니다.

UUID 기반 랜덤 닉네임 생성이 충돌 가능성을 최소화하며, 접두사 K_로 카카오 가입자임을 구분할 수 있어 좋습니다.


22-56: 에러 처리와 스키마 검증이 잘 구현되어 있습니다.

백엔드 응답 검증, HTTP 상태 코드 포함 에러 처리, Zod 스키마를 통한 응답 검증이 모두 적절하게 구현되어 있습니다.

Comment on lines 31 to 42
const signInRes = await fetch(
`${process.env.API_BASE_URL}${API_ENDPOINTS.OAUTH.SIGNIN_PROVIDER('kakao')}`,
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
token: kakaoAuthCode,
redirectUri,
}),
},
);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

API_BASE_URL 환경 변수 검증 필요

process.env.API_BASE_URL가 설정되지 않은 경우를 처리하지 않고 있습니다. 이는 런타임 오류를 발생시킬 수 있습니다.

+  const apiBaseUrl = process.env.API_BASE_URL;
+  if (!apiBaseUrl) {
+    throw new Error('API_BASE_URL이 설정되지 않았습니다.');
+  }
+
   const signInRes = await fetch(
-    `${process.env.API_BASE_URL}${API_ENDPOINTS.OAUTH.SIGNIN_PROVIDER('kakao')}`,
+    `${apiBaseUrl}${API_ENDPOINTS.OAUTH.SIGNIN_PROVIDER('kakao')}`,
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const signInRes = await fetch(
`${process.env.API_BASE_URL}${API_ENDPOINTS.OAUTH.SIGNIN_PROVIDER('kakao')}`,
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
token: kakaoAuthCode,
redirectUri,
}),
},
);
const apiBaseUrl = process.env.API_BASE_URL;
if (!apiBaseUrl) {
throw new Error('API_BASE_URL이 설정되지 않았습니다.');
}
const signInRes = await fetch(
`${apiBaseUrl}${API_ENDPOINTS.OAUTH.SIGNIN_PROVIDER('kakao')}`,
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
token: kakaoAuthCode,
redirectUri,
}),
},
);
🤖 Prompt for AI Agents
In src/app/api/auth/kakao/signin/route.ts around lines 31 to 41, the code uses
process.env.API_BASE_URL without checking if it is defined, which can cause
runtime errors. Add a validation step before the fetch call to verify that
process.env.API_BASE_URL is set; if it is not, throw an appropriate error or
handle the missing environment variable gracefully to prevent runtime failures.

🛠️ Refactor suggestion

fetch 요청에 타임아웃 설정 권장

외부 API 호출 시 네트워크 지연이나 서버 응답 지연으로 인한 무한 대기를 방지하기 위해 타임아웃을 설정하는 것이 좋습니다.

+  const controller = new AbortController();
+  const timeoutId = setTimeout(() => controller.abort(), 10000); // 10초 타임아웃
+
   const signInRes = await fetch(
     `${process.env.API_BASE_URL}${API_ENDPOINTS.OAUTH.SIGNIN_PROVIDER('kakao')}`,
     {
       method: 'POST',
       headers: { 'Content-Type': 'application/json' },
       body: JSON.stringify({
         token: kakaoAuthCode,
         redirectUri,
       }),
+      signal: controller.signal,
     },
-  );
+  ).finally(() => clearTimeout(timeoutId));
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const signInRes = await fetch(
`${process.env.API_BASE_URL}${API_ENDPOINTS.OAUTH.SIGNIN_PROVIDER('kakao')}`,
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
token: kakaoAuthCode,
redirectUri,
}),
},
);
const controller = new AbortController();
const timeoutId = setTimeout(() => controller.abort(), 10000); // 10초 타임아웃
const signInRes = await fetch(
`${process.env.API_BASE_URL}${API_ENDPOINTS.OAUTH.SIGNIN_PROVIDER('kakao')}`,
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
token: kakaoAuthCode,
redirectUri,
}),
signal: controller.signal,
},
).finally(() => clearTimeout(timeoutId));
🤖 Prompt for AI Agents
In src/app/api/auth/kakao/signin/route.ts around lines 31 to 41, the fetch
request lacks a timeout, which can cause indefinite waiting if the external API
is slow or unresponsive. Implement a timeout mechanism by using an
AbortController to abort the fetch request after a specified duration, such as 5
seconds, to prevent hanging requests.

Comment on lines +114 to +117
'message',
error instanceof Error ? error.message : '회원가입 먼저 해주세요.',
);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

URL 쿼리 파라미터로 전달되는 에러 메시지 보안 검토

에러 메시지를 URL 쿼리 파라미터로 전달하는 것은 다음과 같은 보안 위험이 있을 수 있습니다:

  • 민감한 정보가 브라우저 히스토리나 서버 로그에 노출될 수 있음
  • 클라이언트에서 적절히 sanitize하지 않으면 XSS 공격에 취약할 수 있음

Also applies to: 125-126


🏁 Script executed:

#!/bin/bash
# Description: 에러 메시지가 표시되는 컴포넌트에서 적절한 sanitization이 이루어지는지 확인

# KakaoTransition 컴포넌트에서 쿼리 파라미터 처리 확인
rg -A 10 "searchParams.*message" src/domain/Auth/components/KakaoTransition.tsx src/app/\(auth\)/kakao/transition/page.tsx

# Signin 페이지에서 에러 메시지 처리 확인
rg -A 10 "searchParams.*message|error.*message" src/app/\(auth\)/signin/page.tsx src/domain/Auth/components/

Length of output: 2041


XSS 및 민감 정보 노출 위험: URL 쿼리로 전달되는 에러 메시지 처리 필요

현재 구현

  • src/app/api/auth/kakao/signin/route.ts (114–116):
    'message',
    error instanceof Error ? error.message : '회원가입 먼저 해주세요.',
    raw error.message를 쿼리 파라미터로 전달
  • src/domain/Auth/components/KakaoTransition.tsx:
    const message = searchParams.get('message');
    // 별도 이스케이프 없이 렌더링될 경우 XSS 공격 벡터 될 수 있음

위험

  • URL 히스토리, 서버 로그에 민감 정보(스택 트레이스 등) 노출
  • 클라이언트에서 별도 sanitize/escape 없이 출력 시 XSS 취약점 가능

권장 조치

  • 쿼리 파라미터에는 에러 코드를 전달하고, 클라이언트에서 사용자용 메시지로 매핑
  • 불가피하게 메시지를 전달할 경우 encodeURIComponent() 적용 후, React의 기본 이스케이프 기능으로 렌더링
  • 필요 시 DOMPurify 등 라이브러리로 sanitize 검증 추가
  • Sign-in 페이지(src/app/(auth)/signin/page.tsx)에서도 동일한 패턴이 있는지 확인 후 위 조치 적용
🤖 Prompt for AI Agents
In src/app/api/auth/kakao/signin/route.ts lines 114 to 116, avoid passing raw
error.message directly as a URL query parameter to prevent XSS and sensitive
data exposure. Instead, pass a sanitized error code or identifier in the query
parameter. On the client side, map this code to a user-friendly message for
display. If passing messages is unavoidable, apply encodeURIComponent() before
adding to the URL and ensure React's escaping handles rendering safely. Also,
review src/app/(auth)/signin/page.tsx for similar patterns and apply the same
fixes.

Comment on lines +101 to +119
// const errorStatus =
// error instanceof Error && 'status' in error
// ? (error as Error & { status: number }).status
// : undefined;

// if (errorStatus === 409 || errorStatus === 400) {
// const redirectToTransition = new URL(
// '/kakao/transition',
// request.nextUrl.origin,
// );
// redirectToTransition.searchParams.set('status', 'already-exists');
// redirectToTransition.searchParams.set(
// 'message',
// error instanceof Error
// ? error.message
// : '이미 가입된 회원입니다. 로그인해주세요.',
// );
// return NextResponse.redirect(redirectToTransition);
// }
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

주석 처리된 에러 핸들링 코드 정리가 필요합니다.

주석 처리된 transition 페이지 리다이렉션 로직이 있습니다. 이 기능이 향후 구현 예정인지, 아니면 제거해야 할 코드인지 명확히 하시기 바랍니다.

이 기능의 구현 상태를 확인하기 위해 다음 스크립트를 실행해보세요:


🏁 Script executed:

#!/bin/bash
# Description: Check if KakaoTransition component handles 'already-exists' status

# Search for 'already-exists' status handling in KakaoTransition component
rg -A 5 -B 5 "already-exists" src/domain/Auth/components/KakaoTransition.tsx

# Search for similar error handling patterns in signin route
rg -A 5 -B 5 "transition" src/app/api/auth/kakao/signin/route.ts

Length of output: 801


불필요한 주석 정리 또는 기능 구현 결정 필요

src/app/api/auth/kakao/signup/route.ts의 101–119라인에 409/400 에러 발생 시 /kakao/transition?status=already-exists로 리다이렉트하는 주석 처리된 코드가 남아 있습니다. 하지만 src/domain/Auth/components/KakaoTransition.tsx는 현재 need-signup만 처리하며, already-exists 상태에 대한 핸들링이 없습니다.

다음 중 하나를 선택해 주세요:

  • 기능 구현
    • signup 라우트에서 409/400 에러 처리 로직 주석 해제
    • KakaoTransition 컴포넌트에 already-exists 상태에 대한 UI/메시지 추가
  • 기능 제거
    • 위 주석 코드를 삭제

점검이 필요한 위치:

  • src/app/api/auth/kakao/signup/route.ts (라인 101–119)
  • src/domain/Auth/components/KakaoTransition.tsx
🤖 Prompt for AI Agents
In src/app/api/auth/kakao/signup/route.ts lines 101 to 119, decide whether to
implement or remove the commented-out error handling code for 409/400 status
redirecting to /kakao/transition with status=already-exists. To implement,
uncomment this code and add UI/message handling for the already-exists status in
src/domain/Auth/components/KakaoTransition.tsx. To remove, delete the commented
code entirely from the signup route file.

Comment on lines +9 to +11
const KAKAO_REDIRECT_URI = process.env.NEXT_PUBLIC_KAKAO_SIGNUP_REDIRECT_URI!;
const KAKAO_CLIENT_ID = process.env.NEXT_PUBLIC_KAKAO_REST_API_KEY!;

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

환경 변수 검증 추가를 권장합니다.

환경 변수가 누락된 경우에 대한 런타임 검증을 추가하면 더 안전합니다.

-const KAKAO_REDIRECT_URI = process.env.NEXT_PUBLIC_KAKAO_SIGNUP_REDIRECT_URI!;
-const KAKAO_CLIENT_ID = process.env.NEXT_PUBLIC_KAKAO_REST_API_KEY!;
+const KAKAO_REDIRECT_URI = process.env.NEXT_PUBLIC_KAKAO_SIGNUP_REDIRECT_URI;
+const KAKAO_CLIENT_ID = process.env.NEXT_PUBLIC_KAKAO_REST_API_KEY;
+
+if (!KAKAO_REDIRECT_URI || !KAKAO_CLIENT_ID) {
+  throw new Error('카카오 OAuth 환경 변수가 설정되지 않았습니다.');
+}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const KAKAO_REDIRECT_URI = process.env.NEXT_PUBLIC_KAKAO_SIGNUP_REDIRECT_URI!;
const KAKAO_CLIENT_ID = process.env.NEXT_PUBLIC_KAKAO_REST_API_KEY!;
const KAKAO_REDIRECT_URI = process.env.NEXT_PUBLIC_KAKAO_SIGNUP_REDIRECT_URI;
const KAKAO_CLIENT_ID = process.env.NEXT_PUBLIC_KAKAO_REST_API_KEY;
if (!KAKAO_REDIRECT_URI || !KAKAO_CLIENT_ID) {
throw new Error('카카오 OAuth 환경 변수가 설정되지 않았습니다.');
}
🤖 Prompt for AI Agents
In src/domain/Auth/components/KakaoTransition.tsx around lines 9 to 11, the
environment variables KAKAO_REDIRECT_URI and KAKAO_CLIENT_ID are accessed with
non-null assertions but lack runtime validation. Add checks to verify these
environment variables are defined at runtime, and throw an error or handle the
missing case gracefully to prevent runtime failures due to missing environment
variables.

@sgoldenbird sgoldenbird force-pushed the feat/473/oauth-unified branch from ea0b23a to ed2ebee Compare August 4, 2025 16:51
@sgoldenbird sgoldenbird force-pushed the feat/473/oauth-unified branch from 9053e81 to bda0d7c Compare August 5, 2025 01:22
@github-actions
Copy link

github-actions bot commented Aug 5, 2025

✅ Preview Deployment Ready!

🔗 Preview URL: https://roam-ready-63tuizhux-yongmins-projects-bf5f7733.vercel.app
📝 Branch: feat/473/oauth-unified
💾 Commit: Feat/473/oauth unified
🕐 Deployed at:


This preview will be automatically updated on new commits.

@sgoldenbird sgoldenbird force-pushed the feat/473/oauth-unified branch from b7fb2b9 to 4f08ab6 Compare August 6, 2025 05:11
@github-actions
Copy link

github-actions bot commented Aug 6, 2025

✅ Preview Deployment Ready!

🔗 Preview URL: https://roam-ready-kbi5i89nr-yongmins-projects-bf5f7733.vercel.app
📝 Branch: feat/473/oauth-unified
💾 Commit: Feat/473/oauth unified
🕐 Deployed at:


This preview will be automatically updated on new commits.

@sgoldenbird sgoldenbird changed the title Feat/473/oauth unified Feat: oauth unified Aug 6, 2025
@sgoldenbird sgoldenbird merged commit 9edf4c5 into develop Aug 6, 2025
2 checks passed
@sgoldenbird sgoldenbird deleted the feat/473/oauth-unified branch August 6, 2025 11:50
@sgoldenbird sgoldenbird changed the title Feat: oauth unified Feat: 카카오 OAuth 라우트 및 컴포넌트 개선, 전역 에러 페이지 UI 수정 Aug 19, 2025
@sgoldenbird sgoldenbird changed the title Feat: 카카오 OAuth 라우트 및 컴포넌트 개선, 전역 에러 페이지 UI 수정 Refactor: 카카오 OAuth 라우트 및 컴포넌트 개선, 전역 에러 페이지 UI 수정 Aug 19, 2025
@sgoldenbird sgoldenbird changed the title Refactor: 카카오 OAuth 라우트 및 컴포넌트 개선, 전역 에러 페이지 UI 수정 Feat: 카카오 OAuth 라우트 및 컴포넌트 개선, 전역 에러 페이지 UI 수정 Aug 19, 2025
@sgoldenbird sgoldenbird changed the title Feat: 카카오 OAuth 라우트 및 컴포넌트 개선, 전역 에러 페이지 UI 수정 Feat: 카카오 소셜 로그인/회원가입 기능 통합 및 개선 Aug 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants