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:
AUTH_SERVER_URL = "https://login.live.com/oauth20_authorize.srf"
AUTH_TOKEN_URL = "https://login.live.com/oauth20_token.srf"
AUTH_SERVER_URL = "https://mydomain.sharepoint.com/oauth20_authorize.srf"
AUTH_TOKEN_URL = "https://mydomain.sharepoint.com/oauth20_token.srf"
client_secret = ""
client = onedrivesdk.get_default_client(client_id='xxxxxetc',
Auth for OneDrive for Business is handled by AAD, which means you need to point to the AAD OAuth 2 end points, which are:
AUTH_SERVER_URL = "https://login.microsoftonline.com/common/oauth2/authorize" AUTH_TOKEN_URL = "https://login.microsoftonline.com/common/oauth2/token"
This is roughly documented here, https://dev.onedrive.com/auth/aad_oauth.htm, although since that is describing the authentication flow the details are a bit hidden if you were just looking for the two URLs to use with the SDK.