Skip to content

fix: 소셜 로그인 기능 임시 수정#114

Merged
DongEun02 merged 1 commit intomainfrom
social-login
Nov 17, 2025
Merged

fix: 소셜 로그인 기능 임시 수정#114
DongEun02 merged 1 commit intomainfrom
social-login

Conversation

@GamjaIsMine02
Copy link
Contributor

@GamjaIsMine02 GamjaIsMine02 commented Nov 17, 2025

Summary by CodeRabbit

릴리스 노트

  • 새로운 기능

    • 로그인 페이지에 사용자 정보 확인 버튼 추가
  • 개선사항

    • 소셜 로그인 처리 로직 통합 및 최적화
    • OAuth 인증 프로세스 성능 개선
  • 코드 정리

    • 설정 파일 포맷팅 개선

@coderabbitai
Copy link

coderabbitai bot commented Nov 17, 2025

Walkthrough

소셜 로그인 플로우를 재구조화합니다. SocialLoginButtons 컴포넌트의 props를 단일 onSocialLogin 콜백으로 통합하고, LoginForm에서 OAuth 핸들러와 사용자 정보 조회 함수를 추가하며, OAuthSuccess 페이지의 파라미터 파싱을 개선합니다.

Changes

응집도 / 파일(들) 변경 요약
소셜 로그인 props 통합
frontend/src/components/login/SocialLoginButtons.jsx
onGoogle, onGithub, onKakao props를 onSocialLogin 단일 콜백으로 통합; 각 버튼의 클릭 핸들러가 provider 문자열과 함께 onSocialLogin 호출
소셜 로그인 핸들링 확장
frontend/src/components/login/LoginForm.jsx
handleSocialLogin 핸들러 추가 (provider 기반 OAuth 인증 URL 리다이렉트); getUserDetails 비동기 함수 추가 (API 호출 및 사용자 정보 조회); 새로운 "유저 정보 확인" 버튼 UI 추가; 통합된 onSocialLogin prop과 함께 SocialLoginButtons 재구성
OAuth 리다이렉트 파라미터 최적화
frontend/src/pages/OAuthSuccess.jsx
useLocation의 search 파라미터 추출 및 useMemo를 통한 OAuth 파라미터 메모이제이션 추가; params.next 기반 safePath 의존성 최적화
설정 파일 포맷팅
frontend/vite.config.js
import 문 끝에 세미콜론 추가; 객체/배열 항목에 trailing comma 추가; 공백 및 줄 바꿈 조정 (함수 로직 유지)

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant LoginForm as LoginForm
    participant SocialLoginButtons as SocialLoginButtons
    participant OAuth as OAuth Provider
    participant Backend as Backend API
    participant OAuthSuccess as OAuthSuccess Page

    User->>LoginForm: 소셜 로그인 버튼 클릭
    LoginForm->>SocialLoginButtons: onSocialLogin prop 제공
    SocialLoginButtons->>LoginForm: onSocialLogin(provider) 호출
    LoginForm->>LoginForm: handleSocialLogin(provider)
    LoginForm->>OAuth: OAuth2 인증 URL로 리다이렉트
    OAuth->>OAuth: 사용자 인증
    OAuth-->>OAuthSuccess: Authorization code 반환
    OAuthSuccess->>OAuthSuccess: useLocation으로 search params 파싱
    OAuthSuccess->>OAuthSuccess: useMemo로 params 메모이제이션
    OAuthSuccess->>Backend: params.next 기반 safePath 생성
    Backend-->>OAuthSuccess: 사용자 정보 반환
    OAuthSuccess-->>User: 로그인 완료
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 분

  • 주의 영역:
    • SocialLoginButtons의 props 변경으로 인한 모든 사용 사이트 검증 필요
    • LoginFormhandleSocialLogin에서 OAuth URL 생성 로직 및 리다이렉트 메커니즘 검토
    • OAuthSuccess.jsxuseMemo 의존성 배열이 올바르게 설정되었는지 확인 (search 변경 시 재계산 여부)
    • 새로운 getUserDetails API 호출의 오류 처리 및 로깅 안전성 검토

Possibly related PRs

Suggested reviewers

  • DongEun02
  • gxuoo

Poem

🐰 소셜 로그인 길을 정리하며,
콜백 하나로 통합하고,
OAuth 흐름을 매끄럽게 다듬네요.
클릭, 리다이렉트, 로그인 완성! ✨
코드 정원에 새 경로가 피어났어요 🌸

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR 제목이 실제 변경 내용의 핵심을 명확하게 반영하고 있습니다. 소셜 로그인 기능의 구조적 개선(콜백 통합, OAuth2 흐름 추가)을 '임시 수정'으로 표현했으나, 변경된 내용과 직접적으로 관련이 있습니다.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch social-login

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@DongEun02 DongEun02 merged commit 11de50c into main Nov 17, 2025
1 check was pending
@DongEun02 DongEun02 deleted the social-login branch November 17, 2025 05:22
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: 2

🧹 Nitpick comments (1)
frontend/src/components/login/SocialLoginButtons.jsx (1)

7-7: Props 통합 리팩토링이 잘 되었습니다.

세 개의 개별 콜백을 단일 onSocialLogin prop으로 통합한 것은 좋은 개선입니다. 다만 prop 타입 검증(PropTypes 또는 TypeScript)을 추가하면 더욱 안전합니다.

PropTypes를 추가하려면 다음과 같이 작성할 수 있습니다:

import PropTypes from 'prop-types';

// 컴포넌트 정의 후
SocialLoginButtons.propTypes = {
  onSocialLogin: PropTypes.func.isRequired,
};
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 56b455b and 1a9fe38.

📒 Files selected for processing (4)
  • frontend/src/components/login/LoginForm.jsx (3 hunks)
  • frontend/src/components/login/SocialLoginButtons.jsx (3 hunks)
  • frontend/src/pages/OAuthSuccess.jsx (1 hunks)
  • frontend/vite.config.js (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
frontend/src/components/login/LoginForm.jsx (2)
frontend/src/utils/axios.js (2)
  • api (3-6)
  • api (3-6)
frontend/src/components/login/SocialLoginButtons.jsx (1)
  • SocialLoginButtons (7-51)
🔇 Additional comments (5)
frontend/src/pages/OAuthSuccess.jsx (1)

46-52: LGTM! 메모이제이션이 적절하게 적용되었습니다.

URL 파라미터를 useLocation에서 추출하고 useMemo로 메모이제이션하여 불필요한 재계산을 방지하는 구조가 좋습니다. 의존성 배열도 올바르게 설정되어 있습니다.

frontend/vite.config.js (1)

1-37: 포매팅 변경사항이 적절합니다.

세미콜론과 trailing comma 추가는 코드 일관성을 위한 포매팅 변경으로, 기능적인 변경사항은 없습니다.

frontend/src/components/login/SocialLoginButtons.jsx (1)

14-16: 소셜 로그인 핸들러 구현이 올바릅니다.

각 버튼이 해당 provider 값을 전달하여 onSocialLogin을 호출하는 구조가 명확하고 일관성 있습니다.

Also applies to: 26-28, 40-42

frontend/src/components/login/LoginForm.jsx (2)

164-164: SocialLoginButtons 통합이 올바르게 완료되었습니다.

리팩토링된 SocialLoginButtons 컴포넌트에 onSocialLogin prop을 올바르게 전달하고 있으며, handleSocialLogin 함수와 잘 연동되어 있습니다.


14-22: 검증 완료: 함수 사용처 확인됨

검증 결과, getUserDetails 함수는 frontend/src/components/login/LoginForm.jsx 파일에서만 사용되고 있습니다:

  • 정의: 14-22줄
  • 사용: 89줄 (디버그 버튼의 onClick 핸들러)

귀하의 검토 의견이 정확히 확인되었습니다. 함수 구현은 적절하며, 디버그 버튼 제거 시 함께 정리되어야 한다는 권장사항이 타당합니다.

Comment on lines +76 to +81
const handleSocialLogin = (provider) => {
// console.log(
// `${import.meta.env.VITE_API_URL}/oauth2/authorization/${provider}`
// );
window.location.href = `${import.meta.env.VITE_API_URL}/oauth2/authorization/${provider}`;
};
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major

주석 처리된 console.log를 제거하세요.

주석 처리된 디버그 코드는 프로덕션 코드에 남기지 않는 것이 좋습니다.

다음 diff를 적용하여 주석을 제거하세요:

 const handleSocialLogin = (provider) => {
-  // console.log(
-  //   `${import.meta.env.VITE_API_URL}/oauth2/authorization/${provider}`
-  // );
   window.location.href = `${import.meta.env.VITE_API_URL}/oauth2/authorization/${provider}`;
 };
📝 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 handleSocialLogin = (provider) => {
// console.log(
// `${import.meta.env.VITE_API_URL}/oauth2/authorization/${provider}`
// );
window.location.href = `${import.meta.env.VITE_API_URL}/oauth2/authorization/${provider}`;
};
const handleSocialLogin = (provider) => {
window.location.href = `${import.meta.env.VITE_API_URL}/oauth2/authorization/${provider}`;
};
🤖 Prompt for AI Agents
In frontend/src/components/login/LoginForm.jsx around lines 76 to 81, remove the
commented-out console.log debug lines inside handleSocialLogin; delete the two
commented lines so only the working redirect (window.location.href =
`${import.meta.env.VITE_API_URL}/oauth2/authorization/${provider}`;) remains,
then run lint/format to ensure no stray whitespace or commented fragments
remain.

Comment on lines +86 to +97
<button
onClick={async () => {
try {
const user = await getUserDetails();
console.log('USER:', user);
} catch (e) {
console.error(e);
}
}}
>
유저 정보 확인
</button>
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

임시 디버그 버튼을 제거하거나 개발 환경으로 제한하세요.

프로덕션 코드에 스타일링되지 않은 디버그 버튼이 노출되어 있습니다. PR 제목이 "임시 수정"인 점을 고려하면 의도적일 수 있으나, 다음 중 하나를 권장합니다:

  1. 디버그 완료 후 버튼과 getUserDetails 함수를 제거
  2. 개발 환경에서만 표시되도록 조건부 렌더링 적용

옵션 2: 개발 환경에서만 표시

-    <button
-      onClick={async () => {
-        try {
-          const user = await getUserDetails();
-          console.log('USER:', user);
-        } catch (e) {
-          console.error(e);
-        }
-      }}
-    >
-      유저 정보 확인
-    </button>
+    {import.meta.env.DEV && (
+      <button
+        onClick={async () => {
+          try {
+            const user = await getUserDetails();
+            console.log('USER:', user);
+          } catch (e) {
+            console.error(e);
+          }
+        }}
+        style={{
+          padding: '8px 16px',
+          marginBottom: '16px',
+          backgroundColor: '#f0f0f0',
+          border: '1px solid #ccc',
+          borderRadius: '4px',
+          cursor: 'pointer'
+        }}
+      >
+        유저 정보 확인 (개발 전용)
+      </button>
+    )}

디버그 버튼 제거를 원하시면 제가 정리 작업을 도와드릴 수 있습니다. 새 이슈를 생성할까요?

🤖 Prompt for AI Agents
In frontend/src/components/login/LoginForm.jsx around lines 86 to 97, there is
an unstyled debug button calling getUserDetails that should not appear in
production; either remove the button and any related debug-only getUserDetails
usage entirely, or wrap its render in a development-only condition (e.g.,
process.env.NODE_ENV === 'development') so it only mounts in non-production
builds, and ensure any console.log/console.error calls are removed or gated as
well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants