Skip to content

Commit

Permalink
Merge pull request #53 from resum-ai/feat/login
Browse files Browse the repository at this point in the history
fix: redirect uri를 local로 변경
  • Loading branch information
yjoonjang authored Mar 29, 2024
2 parents 06b9b03 + 43c3037 commit eb247e2
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions accounts/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
env.read_env(env_file)

BASE_URL = env("BASE_URL")
KAKAO_CALLBACK_URI = BASE_URL + "accounts/kakao/callback/"
# KAKAO_CALLBACK_URI = BASE_URL + "accounts/kakao/callback/"
KAKAO_CALLBACK_URI = "http://localhost:8000/accounts/kakao/callback"
REST_API_KEY = env("KAKAO_REST_API_KEY")
CLIENT_SECRET = env("KAKAO_CLIENT_SECRET_KEY")

Expand Down Expand Up @@ -61,7 +62,7 @@ def kakao_login(request):
# accept = requests.post(f"{BASE_URL}accounts/kakao/login/finish/", data=data)
# return accept

@extend_schema(exclude=True)
# @extend_schema(exclude=True)
@permission_classes([AllowAny])
def kakao_callback(request):
logger.warning("kakao callback")
Expand Down Expand Up @@ -131,7 +132,6 @@ def kakao_callback(request):
except CustomUser.DoesNotExist:
# 기존에 가입된 유저가 없으면 새로 가입
logger.warning("유저 미존재")
# accept = finish_login(data)
accept = requests.post(f"{BASE_URL}accounts/kakao/login/finish/", data=data)
logger.warning(f"accept: {accept}")
logger.warning(f"accept.reason: {accept.reason}")
Expand All @@ -152,13 +152,14 @@ def kakao_callback(request):
accept_json["userProfile"]["id"] = accept_json["userProfile"].pop("pk")
return JsonResponse(accept_json)

@extend_schema(exclude=True)
# @extend_schema(exclude=True)
class KakaoLoginView(SocialLoginView):
adapter_class = kakao_view.KakaoOAuth2Adapter
client_class = OAuth2Client
callback_url = KAKAO_CALLBACK_URI



class UpdateUserInfoView(APIView):
permission_classes = [IsAuthenticated] # 인증된 사용자만 접근 가능하도록 설정

Expand Down Expand Up @@ -190,3 +191,4 @@ def get(self, request):
user = request.user
serializer = GetUserInfoSerializer(user)
return Response(serializer.data)

0 comments on commit eb247e2

Please sign in to comment.