Skip to content

Commit

Permalink
work on branch since now
Browse files Browse the repository at this point in the history
  • Loading branch information
0-lingual committed Dec 20, 2023
1 parent 8638d9a commit cbf297e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions users/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
class KakaoSignInView(View):
def get(self, request):
app_key = 'a1a341e711531afc648d821e7e1129f9'
redirect_uri = 'http://15.164.56.204:8000/users/signin/kakao/callback'
redirect_uri = 'http://3.39.93.174:8000/users/signin/kakao/callback'
kakao_auth_api = 'https://kauth.kakao.com/oauth/authorize?response_type=code'

return redirect (
f'{kakao_auth_api}&client_id={app_key}&redirect_uri={redirect_uri}'
)


class KakaoSignInCallBackView(View):
class KakaoSignInCallBackViewP(View):

def get(self, request):
auth_code = request.GET["code"]
Expand All @@ -25,11 +25,13 @@ def get(self, request):
data = {
'grant_type': 'authorization_code',
'client_id': 'a1a341e711531afc648d821e7e1129f9',
'redirect_uri': 'http://localhost:3000/login',
'redirect_uri': 'http://3.39.93.174:8000/users/signin/kakao/callback',
'code': auth_code
}

token_response = requests.post(kakao_token_api, data=data)
print(token_response.json())

access_token=token_response.json()["access_token"]
user_info_response = requests.get('https://kapi.kakao.com/v2/user/me', headers={"Authorization": f'Bearer {access_token}'})

Expand Down

0 comments on commit cbf297e

Please sign in to comment.