I am trying to use the OneDrive API Python SDK to upload files to an Office 365 E3 account SharePoint folder.
As described for OneDrive for business / SharePoint files I am using Azure AD that is included in my Office 365 E3 account for auth and have created a native client application app in Azure AD management.
I would expect that I need to point auth to Office 365:
mydomain.sharepoint.com
However, it appears the OneDrive API Python SDK (auth_provider.py) points auth to:
AUTH_SERVER_URL = "https://login.live.com/oauth20_authorize.srf"
AUTH_TOKEN_URL = "https://login.live.com/oauth20_token.srf"
This Github issue discussion indicates OneDrive API Business is still in beta but just changing base urls to mydomain.sharepoint.com
urls is all that is needed to use SDK for OneDrive API Business eg:
AUTH_SERVER_URL = "https://mydomain.sharepoint.com/oauth20_authorize.srf"
AUTH_TOKEN_URL = "https://mydomain.sharepoint.com/oauth20_token.srf"
Is this correct?
Edited to ensure related additional questions are addressed too:
Is there anything else other than the auth urls that needs to be modified in the OneDrive API Python SDK to be used for OneDrive for Business / Sharepoint?
The Github README includes sample code for authentication which requires client_secret
and scopes
to be identified.
However the Azure Active Directory app creation process includes scope identification, and native client app doesn't require client_secret
.
For my native client app authorization, I have just left client_secret
and scopes
blank in the sample code eg:
client_secret = ""
client = onedrivesdk.get_default_client(client_id='xxxxxetc',
scopes=[])