Python Forum
sharepoint: Access has been blocked by Conditional Access policies
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
sharepoint: Access has been blocked by Conditional Access policies
#1
I'm trying to access an excel sheet to extract data, but it is on sharepoint which makes things a bit more complicated.

I'm using this code (snippet):

from office365.runtime.auth.authentication_context import AuthenticationContext from office365.sharepoint.client_context import ClientContext site_url = 'site_url' username = 'username' password = 'password' ctx_auth = AuthenticationContext(site_url) if ctx_auth.acquire_token_for_user(username, password): ctx = ClientContext(site_url, ctx_auth) web = ctx.web ctx.load(web) ctx.execute_query() print('Authenticated into SharePoint as:', web.properties['Title'])
but I'm seeing:

Error:
An error occurred while retrieving token from XML response: AADSTS53003: Access has been blocked by Conditional Access policies. The access policy does not allow token issuance.
Is there a way around this? I don't have many permissions on my organisations sharepoint, and the IT technician responded saying:

Quote:There must be another authentication method made available by Microsoft (“Modern authentication”). The method you use falls under “Legacy authentication” that is set to be deprecated by the end of the year.

He also recommended I use make, but I prefer coding things myself, and I'm trying to use this code for a college project. I've not coded a lot with python at all, so I want to continue to use it to learn.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Question [SOLVED] Access keys and values from nested dictionary? Winfried 4 778 Nov-17-2025, 11:47 AM
Last Post: Winfried
  Why my graph is blocked at 4.2 bars whithout use the valve on my modelisation ? tudy62 2 1,098 Apr-21-2025, 08:35 AM
Last Post: tudy62
  Script problem - Illegal access to removed OSM object MarcPolo72 0 1,735 Jun-23-2024, 04:26 PM
Last Post: MarcPolo72
  Circumvent the "access denied" page? Pedroski55 7 3,613 Jun-15-2024, 06:25 AM
Last Post: Pedroski55
  How to get all items in SharePoint recycle bin by using sharepy library in Python? QuangHuynh 2 2,352 Apr-10-2024, 03:09 PM
Last Post: SandraYokum
  How to receive two passed cmdline parameters and access them inside a Python script? pstein 2 1,914 Feb-17-2024, 12:29 PM
Last Post: deanhystad
  How to access values returned from inquirer cspower 6 4,428 Dec-26-2023, 09:34 PM
Last Post: cspower
  Updating sharepoint excel file odd results cubangt 1 2,916 Nov-03-2023, 05:13 PM
Last Post: noisefloor
  Pytest Installed, but VS Code Won’t Access Pytest AstralWeeks 9 25,503 Sep-13-2023, 03:00 PM
Last Post: AstralWeeks
  How can I access objects or widgets from one class in another class? Konstantin23 3 3,572 Aug-05-2023, 08:13 PM
Last Post: Konstantin23

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020
This forum uses Lukasz Tkacz MyBB addons.
Forum use Krzysztof "Supryk" Supryczynski addons.