Ранее я использовал код:
Код: Выделить всё
context_auth = AuthenticationContext(url=site_url)
context_auth.acquire_token_for_app(
client_id=app_principal['client_id'],
client_secret=app_principal['client_secret'])
Код: Выделить всё
url = "https://login.microsoftonline.com/" + authgraph['tenantid'] + "/oauth2/v2.0/token"
body = {
"client_id":authgraph['clientid'],
"scope":authgraph['graphuserscopes'],
"username": authgraph['username'],
"password": authgraph['password'],
"grant_type":"password",
"client_secret":authgraph['clientsecret']
}
r = requests.post(url, data=body, headers={'Content-Type':'application/x-www-form-urlencoded'})
data = json.loads(r.content)
return data['access_token']
Нужно ли мне реализовывать его вручную?
Подробнее здесь: https://stackoverflow.com/questions/787 ... lf-of-user