введите описание изображения здесь Вопрос: Почему я получаю 40x, когда тот же токен работает на других вызовах отдыха, но не на календарях.Я работаю с электронной почтой, пользователями и т. Д.
Я получил токен доступа и авторизацию.Получение токена:
authentication_endpoint = 'https://login.microsoftonline.com/'
resource = "https://graph.microsoft.com"
context = adal.AuthenticationContext(authentication_endpoint + tenantId)
token_response = context.acquire_token_with_client_credentials(resource, clientId, clientKey)
access_token_gmc = token_response.get('accessToken')
print("FD:::access_token-graphmicrosoft:", access_token_gmc)
Что работает:
endpoint = "https://graph.microsoft.com/v1.0/reports/getOffice365ActiveUserDetail%28period%3D%27D7%27%29"
print("FD:O365:CalendarList-ActvUsers:" + endpoint)
headers = {"Authorization": 'Bearer ' + access_token_gmc}
response = requests.get(endpoint, headers=headers)
С тем же токеном - я пробовал это, и оно не работает:
endpoint = "https://graph.microsoft.com/v1.0/me/calendars"
print("FD:O365:CalendarList:" + endpoint)
headers = {"Authorization": 'Bearer ' + access_token_gmc}
response = requests.get(endpoint, headers=headers)
Ошибка:
FD:O365:CalendarList:https://graph.microsoft.com/v1.0/me/calendars
('FD::0365:CalendarsList:', 400, u'https://graph.microsoft.com/v1.0/me/calendars')
('FD::0365:CalendarsList-Response', <Response [401]>)
('FD:0365:CalendarsList-Text:', u'{\r\n "error": {\r\n "code": "InvalidAuthenticationToken",\r\n "message": "Access token is empty.",\r\n "innerError": {\r\n "request-id": "3237....e",\r\n "date": "2018-10-24T23:06:20"\r\n }\r\n }\r\n}')
Проверить изображение: