在测试Facebook身份验证时,我遇到以下问题
Exception Type: MultiValueDictKeyError at /api/social/convert-token
Exception Value: 'user_type'
Request information:
USER: AnonymousUser
我正在以下文件中过滤用户
def create_user_by_type(backend, user, request, response, *args,
**kwargs):
if backend.name == 'facebook':
avatar = 'https://graph.facebook.com/%s/picture?type=large' %
response['id']
if request['user_type'] == "driver" and not
Driver.objects.filter(user_id=user.id):
Driver.objects.create(user_id=user.id, avatar=avatar)
elif not Customer.objects.filter(user_id=user.id):
Customer.objects.create(user_id=user.id, avatar=avatar)
当我在管理页面中检查“用户”表时,它正在创建用户,但未在创建令牌。
我正在使用Django==2.1.7
django-rest-framework-social-oauth2==1.1.0