`url='https://login.microsoftonline.com/'+ten ... v2.0/token'
header={}
header['Content-Type']='application/x-www-form-urlencoded'
data={}
data['client_id']=client_id
data[ 'scope']='User.Read'
data['code']=code
data['redirect_uri']='https://localhost/myapp/'
data[' grant_type']='authorization_code'
data['client_secret']=client_secret
Код: Выделить всё
x=requests.post(url,headers=header,data=data)
print(x.text)
x=x.json()
#print(x)
tok=x['access_token']
url='https://graph.microsoft.com/v1.0/me'
header={}
header['Authorization']:'Bearer '+tok
data={}
x=requests.get(url,headers=header,data=data)`
Ошибка трассировки показывает:
tok=x['access_token']
KeyError: 'access_token'
X отвечает кодом 400, и хотя значение redirect_uri такое же, ошибка кажется странной. Есть ли какие-либо решения или предложения, что можно сделать по-другому?
Подробнее здесь: https://stackoverflow.com/questions/785 ... user-using