2
Kakao OAuth2 backend, docs at:
3
https://python-social-auth.readthedocs.io/en/latest/backends/kakao.html
5
from .oauth import BaseOAuth2
8
class KakaoOAuth2(BaseOAuth2):
9
"""Kakao OAuth authentication backend"""
11
AUTHORIZATION_URL = 'https://kauth.kakao.com/oauth/authorize'
12
ACCESS_TOKEN_URL = 'https://kauth.kakao.com/oauth/token'
13
ACCESS_TOKEN_METHOD = 'POST'
14
REDIRECT_STATE = False
16
def get_user_id(self, details, response):
19
def get_user_details(self, response):
20
"""Return user details from Kakao account"""
21
nickname = response['properties']['nickname']
30
def user_data(self, access_token, *args, **kwargs):
31
"""Loads user data from service"""
32
return self.get_json('https://kapi.kakao.com/v1/user/me',
33
params={'access_token': access_token})
35
def auth_complete_params(self, state=None):
37
'grant_type': 'authorization_code',
38
'code': self.data.get('code', ''),
39
'client_id': self.get_key_and_secret()[0],