[#29] Feat/29/로그인기능 - #30
Merged
Hidden character warning
The head ref may contain hidden characters: "Feat/29/\ub85c\uadf8\uc778\uae30\ub2a5"
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
minzx23
approved these changes
May 6, 2026
minzx23
left a comment
Collaborator
There was a problem hiding this comment.
잘 돌아갑니다~! 확실히 코드가 많이 추가됐네욤 고생하셨습니다!!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
❓이슈
📝 Description
이메일/비밀번호 기반의 일반 로그인 및 회원가입 기능을 구현합니다.
next-auth v4+Credentials Provider를 사용하며, 백엔드 REST API와 연동합니다.구현 흐름
회원가입
사용자 입력
→ 클라이언트 유효성 검사 (blur 이벤트 + 제출 시점)
→ Server Action (signupAction)
→ 백엔드 POST /api/v1/auth/signup 호출
→ 성공 시 /login으로 redirect
→ 실패 시 에러 코드별 분기 처리 (409: 이메일 중복, 400: 비밀번호 형식)
로그인
사용자 입력
→ 클라이언트 유효성 검사 (blur 이벤트 + 제출 시점)
→ next-auth signIn('credentials') 호출
→ NextAuth authorize() 내부에서 백엔드 POST /api/v1/auth/signin 호출
→ 성공 시 백엔드 accessToken을 JWT에 저장 → 암호화되어 쿠키에 저장
→ /workspace로 이동
→ 실패 시 이메일 입력칸 하단에 에러 메시지 노출
라우트 보호
요청 발생
→ middleware에서 next-auth/jwt의 getToken()으로 쿠키 내 JWT 확인
→ 비로그인 상태에서 /workspace, /mypage 접근 시 /login으로 redirect
→ 로그인 상태에서 /login, /signup 접근 시 /workspace로 redirect
주요 파일 설명
src/types/auth.tssrc/types/next-auth.d.tssrc/lib/auth-api.tsApiError클래스로 HTTP 상태코드 전달src/app/api/auth/[...nextauth]/route.tssrc/middleware.tsgetToken()으로 Edge Runtime에서 안전하게 인증 상태 확인 후 라우팅src/components/AuthProvider.tsxSessionProvider래퍼. 클라이언트에서useSession()사용을 위해 필요src/app/layout.tsxAuthProvider적용src/app/(before-login)/(auth)/signup/_actions.tssrc/app/(before-login)/(auth)/signup/page.tsxsrc/app/(before-login)/(auth)/login/page.tsxsrc/components/TempLogoutButton.tsxsrc/app/(before-login)/(landing)/page.tsx유효성 검사 규칙
로그인
회원가입
!@#$%^&*) 조합🌀 PR Type
어떤 변경 사항이 있나요?
✅ Checklist
PR Checklist
PR이 다음 요구 사항을 충족하는지 확인하세요.
Test Checklist