Open thibedi-phathela opened 6 months ago
Same issue here ✋
When I login manually, no additional verification is required, only name + pass
The problem is with authentication. In my case, I couldn't use my credentials (user and password) because of the way my company setup the access to the Sharepoint.
The solution can be found in the section "Setting up an app-only principal with tenant permissions" of https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/security-apponly-azureacs
Once you have access to client_id and client_secret, use them to create the authentication. Please, see the example below:
from office365.sharepoint.client_context import ClientContext from office365.runtime.auth.authentication_context import AuthenticationContext
client_id="{client id}" client_secret="{client secret}" url = "https://{tenant}.sharepoint.com/sites/{site}"
ctx_auth = AuthenticationContext(url) if ctx_auth.acquire_token_for_app(client_id, client_secret): ctx = ClientContext(url, ctx_auth) web = ctx.web ctx.load(web) ctx.execute_query() print("Web title: {0}".format(web.properties['Title']))
else: print(ctx_auth.get_last_error())
Hello!
Has anyone encountered an authentication issue recently using the Office365 library?
ERROR:office365.runtime.auth.providers.saml_token_provider.SamlTokenProvider._process_service_token_response:Cannot get binary security token for from https://login.microsoftonline.com/extSTS.srf An error occurred: Cannot get binary security token for from https://login.microsoftonline.com/extSTS.srf
site_url = "" username = "" password = ""
ctx_auth = AuthenticationContext(url=site_url) if not ctx_auth.acquire_token_for_user(username=username, password=password): exit(1)
ctx = ClientContext(site_url, ctx_auth)
def download_files_from_folder(folder_url, local_path): try: folder = ctx.web.get_folder_by_server_relative_url(folder_url) ctx.load(folder) ctx.execute_query()
folder_url = "" local_path = ""
download_files_from_folder(folder_url, local_path)
Is there anything that has changed or that I'm missing ?