Skip to content

Commit

Permalink
set cookie 로직 제거
Browse files Browse the repository at this point in the history
  • Loading branch information
G-D4R3 committed Oct 13, 2024
1 parent 341b3b4 commit 2f76939
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 77 deletions.
33 changes: 0 additions & 33 deletions WAKe_server/middleware.py

This file was deleted.

1 change: 0 additions & 1 deletion WAKe_server/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
"django.middleware.common.CommonMiddleware",
"django.middleware.csrf.CsrfViewMiddleware",
"django.contrib.auth.middleware.AuthenticationMiddleware",
"WAKe_server.middleware.CustomAuthenticationMiddleware",
"django.contrib.messages.middleware.MessageMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware",
"allauth.account.middleware.AccountMiddleware",
Expand Down
48 changes: 5 additions & 43 deletions social_app/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from allauth.socialaccount.providers.kakao import views as kakao_view
from allauth.socialaccount.providers.oauth2.client import OAuth2Client
from accounts.models import User, CommonProfile
from accounts.serializers import UserSerializer, LogoutSerializer, KakaoCallbackSerializer
from accounts.serializers import LogoutSerializer, KakaoCallbackSerializer
from accounts.utils import token_serializer

KAKAO_TOKEN_API = "https://kauth.kakao.com/oauth/token"
Expand Down Expand Up @@ -91,26 +91,7 @@ def callback(self, request: Request):
user = User.objects.get(email=email)
token = token_serializer(user)
access_token = token['access']
refresh_token = token['refresh']
res = redirect(LOGIN_REDIRECT_URL+f'?access={access_token}&refresh={refresh_token}')
res.set_cookie(
'access',
access_token,
max_age=3600 * 24 * 3,
domain='.zps.kr',
secure=True,
httponly=True,
samesite=False,
)
res.set_cookie(
'refresh',
refresh_token,
max_age=3600 * 24 * 3,
domain='.zps.kr',
secure=True,
httponly=True,
samesite=False,
)
res = redirect(LOGIN_REDIRECT_URL+f'?t={access_token}')
return res

except User.DoesNotExist:
Expand All @@ -132,26 +113,7 @@ def callback(self, request: Request):
user = User.objects.get(email=email)
token = token_serializer(user)
access_token = token['access']
refresh_token = token['refresh']
res = redirect(LOGIN_REDIRECT_URL+f'?access={access_token}&refresh={refresh_token}')
res.set_cookie(
'access',
access_token,
max_age=3600 * 24 * 3,
domain='.zps.kr',
secure=True,
httponly=True,
samesite=False,
)
res.set_cookie(
'refresh',
refresh_token,
max_age=3600 * 24 * 3,
domain='.zps.kr',
secure=True,
httponly=True,
samesite=False,
)
res = redirect(LOGIN_REDIRECT_URL + f'?t={access_token}')
return res
except Exception as e:
return Response(status=status.HTTP_400_BAD_REQUEST)
Expand All @@ -163,5 +125,5 @@ class KaKaoLogin(SocialLoginView):
client_class = OAuth2Client

def post(self, request, *args, **kwargs):
print(request.POST)
return super().post(request, *args, **kwargs)
res = super().post(request, *args, **kwargs)
return res

0 comments on commit 2f76939

Please sign in to comment.