-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoutlookAPI.py
More file actions
26 lines (20 loc) · 770 Bytes
/
outlookAPI.py
File metadata and controls
26 lines (20 loc) · 770 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import requests
# tenant = '87b04d11-3e69-407f-949c-96ff7de6f036'
tenant = 'common'
client_id = '56cf533e-417a-456a-9d46-a4e893bd642d'
# redirect_uri = 'http://localhost:8000'
# redirect_uri = 'https://login.microsoftonline.com/common'
redirect_uri = 'https://login.microsoftonline.com/common/oauth2/v2.0/authorize'
url = 'https://login.microsoftonline.com/{tenant}/oauth2/v2.0/authorize'
params = {
'client_id': client_id,
'response_type': 'code',
'redicect_uri': redirect_uri,
'response_mode': 'query',
'scope': 'offline_access User.Read Mail.Read',
'state': '12345'
} # Optional query parameters
response = requests.get(url, params=params)
with open('index.html', 'w', encoding='utf-8') as f:
f.write(response.text)
print(response)