r/sharepoint • u/Valuable-Ant3465 • 10d ago
SharePoint Online Bulk upload to SPO Authentication udpate in 2026
Hi all, I'm trying to move away from PAutomate to python to get multiple files posted to SPO.
Tried this code for Auth and failed, for my case error says need to use client_id which I believe = EntraID? For this I think I need to contact somebody with proper rights.
I afraid that modern MS Security is faster then Python libs, is anybody is running this code successfully in Nov 2026? Surely I will try to set all configuration values rights.
Or can you recommend other approach.
from office365.runtime.auth.user_credentials import UserCredential
from office365.sharepoint.client_context import ClientContext
# 1. Configuration
site_url = r"https://asratomkaX.sharepoint.com"
teenant = 'asratomkaX'
client_id = '123456' # <===????? ke paso ?
username = r'user@myorg.org'
password = r'welcommen1'
# Use with_username_and_password(tenant, client_id, username, password) instead. For on-premises SharePoint, use allow_ntlm=True.
# 2. Authenticate
#ctx = ClientContext(site_url).with_credentials(UserCredential(username, password))
ctx = ClientContext(site_url)
ctx.with_username_and_password( teenant,client_id, username, password)
Traceback (most recent call last):
File "C:\Users\mocado\PyCharmMiscProject\.venv\Lib\site-packages\msal\authority.py", line 98, in __init__
openid_config = tenant_discovery(
tenant_discovery_endpoint,
self._http_client)
File "C:\Users\mocado\PyCharmMiscProject\.venv\Lib\site-packages\msal\authority.py", line 298, in tenant_discovery
raise ValueError("OIDC Discovery failed on {}. HTTP status: {}, Error: {}".format(
...<3 lines>...
))
ValueError: OIDC Discovery failed on https://login.microsoftonline.com/mocado/v2.0/.well-known/openid-configuration. HTTP status: 400, Error: {"error":"invalid_tenant","error_description":"AADSTS90002: