-
-
Notifications
You must be signed in to change notification settings - Fork 369
Expand file tree
/
Copy pathwith_interactive.py
More file actions
22 lines (17 loc) · 780 Bytes
/
Copy pathwith_interactive.py
File metadata and controls
22 lines (17 loc) · 780 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
"""
Connect to SharePoint using interactive browser-based login.
Useful when multi-factor authentication (MFA) is required or
when user consent for additional permissions is needed.
Prerequisites:
- In Azure Portal, configure the Redirect URI of your
"Mobile and Desktop application" as ``http://localhost``.
See https://learn.microsoft.com/en-us/azure/active-directory/develop/
msal-authentication-flows#interactive-and-non-interactive-authentication
"""
from office365.sharepoint.client_context import ClientContext
from tests import test_client_id, test_site_url, test_tenant
ctx = ClientContext(test_site_url).with_interactive(test_tenant, test_client_id)
me = ctx.web.current_user.get().execute_query()
print(me)
web = ctx.web.get().execute_query()
print(web)