Skip to content

fix: 소셜로그인 로직 수정#139

Merged
heeeeyong merged 1 commit intodevelopfrom
chore/minor-updates
Aug 17, 2025
Merged

fix: 소셜로그인 로직 수정#139
heeeeyong merged 1 commit intodevelopfrom
chore/minor-updates

Conversation

@heeeeyong
Copy link
Collaborator

@heeeeyong heeeeyong commented Aug 17, 2025

이하동일

Summary by CodeRabbit

  • 신기능

    • 소셜 로그인 리다이렉트 이후 자동으로 토큰을 교환하고, 회원가입 경로에서는 쿠키를 설정합니다.
    • 처리 완료 후 URL의 임시 토큰 파라미터를 자동 제거합니다.
    • 오류 발생 시 안전하게 홈으로 이동하도록 처리했습니다.
  • 리팩터링

    • 기존 OAuth 토큰 처리 로직을 새로운 소셜 로그인 토큰 처리 흐름으로 전면 교체했습니다.
    • 피드 및 회원가입 화면에 새로운 토큰 처리 로직을 적용하고, 구방식 구현을 제거했습니다.

@heeeeyong heeeeyong self-assigned this Aug 17, 2025
@heeeeyong heeeeyong added the 🐞 BugFix Something isn't working label Aug 17, 2025
@vercel
Copy link

vercel bot commented Aug 17, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
thip Ready Ready Preview Comment Aug 17, 2025 6:51am

@heeeeyong heeeeyong added the 📬 API 서버 API 통신 label Aug 17, 2025
@coderabbitai
Copy link

coderabbitai bot commented Aug 17, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

소셜 로그인 리다이렉트 후 토큰 처리 흐름을 재구성. 신규 API 헬퍼(setCookie, exchangeTempToken) 추가 및 auth index에 재노출. 기존 useOAuthToken 훅 삭제, useSocialLoginToken 훅 신설. Feed/Signup 페이지들은 새 훅으로 교체하고, URL의 loginTokenKey 처리 및 후속 네비게이션을 정리.

Changes

Cohort / File(s) Summary
Auth API helpers
src/api/auth/setCookie.ts, src/api/auth/exchangeTempToken.ts, src/api/auth/index.ts
신규 POST 헬퍼 추가: /auth/set-cookie, /auth/exchange-temp-token. 요청 타입은 빈 객체, 응답 타입 명시. index에서 setCookie, exchangeTempToken 재수출.
Auth hook migration
src/hooks/useOAuthToken.ts, src/hooks/useSocialLoginToken.ts
기존 useOAuthToken 삭제. 신규 useSocialLoginToken 추가: URL의 loginTokenKey를 읽어 /signup 경로면 set-cookie 호출, 그 외 경로면 exchange-temp-token 호출. 성공 시 쿼리 파라미터 제거, 실패 시 로그/리다이렉트 처리.
Consumers updated
src/pages/feed/Feed.tsx, src/pages/signup/SignupGenre.tsx, src/pages/signup/SignupNickname.tsx
훅 사용을 useOAuthToken에서 useSocialLoginToken으로 교체. SignupGenre에 훅 추가 호출. 다른 로직 변경 없음.

Sequence Diagram(s)

sequenceDiagram
  participant B as Browser
  participant R as App Router
  participant H as useSocialLoginToken
  participant A as Auth API
  participant W as Window History

  B->>R: 방문 (리다이렉트 후 URL?loginTokenKey=...)
  R->>H: 훅 마운트
  H->>H: loginTokenKey 파싱
  alt 경로 === /signup
    H->>A: POST /auth/set-cookie { loginTokenKey } (withCredentials)
    A-->>H: 200 응답
    H->>W: replaceState (loginTokenKey 제거)
  else 기타 경로
    H->>A: POST /auth/exchange-temp-token { loginTokenKey } (withCredentials)
    A-->>H: 200 응답 (accessToken 포함)
    H->>W: replaceState (loginTokenKey 제거)
    opt 실패 시
      H->>R: navigate("/")
    end
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • ho0010

Poem

토끼는 깡총, 토큰을 척척!
쿠키는 사르륵, 주소는 쓱쓱—정리 끝.
가입 길엔 쿠키, 피드 길엔 교환권,
파라미터는 안녕! 새 출발은 지금부터.
(•̀ᴗ•́)و ̑̑ 로그인 완주!


📜 Recent review details

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

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 72e5f2b and cc1129b.

📒 Files selected for processing (8)
  • src/api/auth/exchangeTempToken.ts (1 hunks)
  • src/api/auth/index.ts (1 hunks)
  • src/api/auth/setCookie.ts (1 hunks)
  • src/hooks/useOAuthToken.ts (0 hunks)
  • src/hooks/useSocialLoginToken.ts (1 hunks)
  • src/pages/feed/Feed.tsx (2 hunks)
  • src/pages/signup/SignupGenre.tsx (2 hunks)
  • src/pages/signup/SignupNickname.tsx (2 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/minor-updates

🪧 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.
    • 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.
  • 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 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/Issue comments)

Type @coderabbitai help to get the list of available commands.

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

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • 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.

@heeeeyong heeeeyong merged commit 7509bb7 into develop Aug 17, 2025
2 of 3 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Aug 20, 2025
@coderabbitai coderabbitai bot mentioned this pull request Sep 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

📬 API 서버 API 통신 🐞 BugFix Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant