生成令牌时出现错误“缺少授权类型”

时间:2019-05-04 06:52:46

标签: python django

当我尝试生成令牌时,我会丢失授权类型错误。即使我在有效负载中传递授权类型

@csrf_exempt
@api_view(['POST'])
def merchanttokengeneration(request):

    payload = request.data


    token = request.META.get('HTTP_TOKEN')

    headers = {"token": token, "Content-Type":"application/json"}
    print(headers)

    response = requests.request("POST",'https://staging/merchant/v1/oauth/token', data=json.dumps(payload),headers=headers, auth=HTTPBasicAuth(payload.get('username'), payload.get('password') ))

    print(response)
    return HttpResponse(response)

0 个答案:

没有答案