unable to get auth token when only having access to a particular Sharepoint site
Hello, I am trying to get data from a site at abc company. I was granted full access to
https://abc.sharepoint.com/sites/relevantSite/SitePages/relevantPage.aspx
but not to the root
https://abc.sharepoint.com
I tried authenticating using the following code:
from office365.runtime.auth.user_credential import UserCredential
from office365.sharepoint.client_context import ClientContext
username = "username"
password = "password"
site_url = "https://abc.sharepoint.com/sites/relevantSite"
ctx = ClientContext(site_url).with_credentials(UserCredential(username, password))
web = ctx.web
ctx.load(web)
ctx.execute_query()
print("Web title: {0}".format(web.properties['Title']))
But I just got the following error:
ValueError: Acquire token failed: An error occurred while retrieving auth cookies from https://abc.sharepoint.com/_forms/default.aspx?wa=wsignin1.0
Is there a way to make it authorise against the site that I have access to instead of the root?
were u able to resolve this For this U need to create Client ID and clinet secret using sharapoint app only https://docs.microsoft.com/en-us/sharepoint/dev/solution-guidance/security-apponly-azureacs#setting-up-an-app-only-principal-with-tenant-permissions
having this same issue. the link provide is for older acl, not azure cloud.