Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot get binary security token for from https://login.microsoftonline.com/extSTS.srf #860

Open
thibedi-phathela opened this issue May 15, 2024 · 0 comments
Labels

Comments

@thibedi-phathela
Copy link

thibedi-phathela commented May 15, 2024

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()

    if not os.path.exists(local_path):
        os.makedirs(local_path)

    files = folder.files
    ctx.load(files)
    ctx.execute_query()
    for file in files:
        download_path = os.path.join(local_path, file.name)
        with open(download_path, "wb") as local_file:
            file.download(local_file)
            ctx.execute_query()
        print(f"File downloaded: {download_path}")
except Exception as e:
    print(f"An error occurred: {e}")

folder_url = ""
local_path = ""

download_files_from_folder(folder_url, local_path)

Is there anything that has changed or that I'm missing ?

@vgrem vgrem added the question label May 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants