refactor: #54 Firebase SDK를 통한 사용자 인증 기능 구현 #55
+1,370
−14
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
closes #54
프리온보딩 챌린지 당시 기능요구사항 문서에 제공된 API가 닫혔습니다. 그래서 현재 투두리스트 관련한 기능들이 제대로 동작하지 않고 있습니다.
그 중, 사용자가 우리 프로젝트에서 가장 처음 마주하게 되는
인증
관련 기능들을 Firebase로 리팩토링을 진행했습니다.Firebase SDK 동작 방식
파이어베이스 앱 생성 및 설정 파일 생성
파이어베이스 사이트에서 처음 프로젝트를 생성하고 나면, 파이어베이스 앱을 초기화 할 수 있는 설정 코드 스니펫을 제공해줍니다.
그 코드를 복사하여 전역에서 참조하여 사용할 수 있는 파이어베이스 인스턴스
app
을 생성해줍니다.파이어페이스의 모든 기능은 app 인스턴스를 활용하여 접근할 수 있습니다. 저는 인증 관련 기능을 사용하기 위해서 파이어베이스와 연결된 인증 인스턴스를
getAuth()
API 함수를 활용하여 반환해 사용하겠습니다.현재 설정값들이 저장되어있는
firebaseConfig
를 보시면 전부 환경변수를 참조하고 있습니다. 로컬 개발 시에는.env.local
에 환경변수 값들을 저장해두어 사용했고, 배포시에는 netlify 콘솔에서 환경변수를 추가하여 사용했습니다.파이어베이스 인증 관련 기능 문서을 참고하시면 더 수월한 리뷰가 될 것 같아 첨부해보았습니다.
createUserWithEmailAndPassword
,signinWithEmailAndPassword
,signout
API 함수를 사용하여 가입, 로그인, 로그아웃을 구현하였습니다.사용자 정보는 파이어베이스에서 자체적으로 관리하고 있습니다.
테스트주소
작업 브랜치 프리뷰 링크
https://deploy-preview-55--our-todo-list.netlify.app/
를 통해서 회원가입, 로그인, 로그아웃 기능을 확인할 수 있습니다!