본문 바로가기

기타/개발일지

[2022-06-22] 개발일지

반응형


1. Project

TourApp Project ( Backend - DRF )


2. Process

Social Sign in / Sign up (Social Login) 기능


3. Issue

1) Login 할 때 받아야 할 정보를 email 과 username 으로 고정
2) User가 이미 가입된 상황에서 Login 기능 구현
3) Session 사용하지 않기
4) User의 정보 Update를 위한 serializer 및 view 구현
5) return 할 페이지 view, serializer 구현


4. Today Study Contents

1) Login 할 때 받아야 할 정보

Naver로 Login 할 때 email과 username만 받도록 설정했다. 이때 DB에 username 필드에는 Naver 의 별명 혹은 이메일의 앞부분으로 추가된다. 네이버 이메일이 ly**92@naver.com 인 경우 ly**92 로 들어간다.

2) User가 이미 가입된 상황에서 Login 기능 구현

우선은 Naver로만 로그인이 가능하도록 구축했기  때문에 이 문제는 추후에 다시 고민하도록 한다.

3) Session 사용하지 않기

아직까지 풀리지 않는 숙제이다. 지금 pyjwt 를 사용하는 방법과 djangorestframework-simplejwt 를 사용하는 방법, 두 가지를 모두 고려해서 테스트 해보았다. 기존에 pyjwt를 사용해서 토큰을 발급했을 때에는 Session이 쌓이지 않았는데, 소셜로그인 하는 기능을 추가하니 django_session 에 데이터가 계속 쌓였다. 아마도 dj_rest_auth 나 allauth 에서 session 을 추가하는 거 같은데..

dj_rest_auth 에서 REST_SESSION_LOGIN 을 False로 두어도 자꾸만 Session 데이터가 쌓여만 갔다. 총 이틀동안 이것저것 실험해보고 Reference도 뒤져가면서 해결해보려 했지만 실패했다.

SESSION 에 대한 이해가 더 필요할 것으로 보이고, SESSION 를 충분히 이해한 후에 코드를 변경하도록 하자.

5. Reference

https://dj-rest-auth.readthedocs.io/en/latest/introduction.html

 

Introduction — dj-rest-auth 2.2.4 documentation

Introduction Since the introduction of django-rest-framework, Django apps have been able to serve up app-level REST API endpoints. As a result, we saw a lot of instances where developers implemented their own REST registration API endpoints here and there,

dj-rest-auth.readthedocs.io

https://django-allauth.readthedocs.io/en/latest/installation.html

 

Installation — django-allauth 0.43.0 documentation

Post-Installation In your Django root execute the command below to create your database tables: Now start your server, visit your admin pages (e.g. http://localhost:8000/admin/) and follow these steps: Add a Site for your domain, matching settings.SITE_ID

django-allauth.readthedocs.io


6. Plan Study for Tomorrow

1) User의 정보 Update를 위한 Serializer 및 View 구현
2) return 할 페이지 구현
3) 안드로이드 일부 구현(Login 버튼 / 회원정보 수정 페이지 등)


 

반응형

'기타 > 개발일지' 카테고리의 다른 글

[맥OS] Mac OS 단축키 및 Xcode 단축키  (0) 2022.11.01
[2022-06-29] 개발일지  (0) 2022.06.29
[2022-06-28] 개발일지  (0) 2022.06.28
[2022-06-23] 개발일지  (0) 2022.06.27
[2022-06-20] 개발일지  (0) 2022.06.20