-
-
Notifications
You must be signed in to change notification settings - Fork 318
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
Unable to conect to Sharepoint (retrieving token from XML error) #207
Comments
Greetings! Surprisingly this error is not listed among Azure AD STS error codes To pinpoint it, could you please clarify the following questions:
|
Another option would be to switch from user credentials flow to app principals flow. Refer this article on how to register an app principal and grant access via SharePoint App-Only flow Here is an example:
|
Good Afternoon Thanks for your fast answer and help.
I´m using a corporate account with the following format myname@external.mycompany.com
I´ve asked the IT in my company and they told me my account doesn´t have the Multi-factor authetication active, Althought there are some account with the Multi-factor activate Also I have asked for the app principals credentials but unfortunantely I don´t have permision to set it up myself so I have to wait for them to do it. |
Regarding app principal permissions, in the provided article,
Site collection page url:
|
Good Afternoon, I have more information about the error. I have tried to connect with an IT service user and I got this error Cannot get binary security token for from https://login.microsoftonline.com/extSTS.srf The user name is ALSSVSHNGSDES in case it gives you some information On the other hand, I've been trying to create and access via SharePoint App-Only but I don't know how to file properly the filds APP Domain and Redirect URI, I have tried to set my sharepoint address in both but it's always giving me an error so i guess it's not the correct information. Thanks in advance. |
Good evening, regarding
the error probably occurs due to the values specified for App Domain and Redirect URI, please refer below instruction for a more details. Here is an instruction to create app based credentials:
As a proof-of-concept here is an example of running the following script in Jupiter Notebook
Result |
Good Morning, I´ve been trying to set up the API following the isntruction but I can´t. When I set APP Domain as www.localhost.com and Redirect URI as https://www.localhost.com I recieve the following error: Invalid APP Domain. I Attached a screenshoot from my last attempt. Can you tell me what is that im doing incorrectly? I guess that to put "localhost" as App Domain was an example and it was not a proper URI for Sharepoint but at this point I am really lost about what to put in the "App domain" and "Redirect URI" fields. Many thanks in advance! |
Good morning, how about |
I guess it's been resolved so closing this one. |
Good Afternoon Sorry I didn´t answer earlier. I think it is happening because they didn't give the API full access in the XML permision request. I´m having the following error when I do the request (sorry it´s in Spanish): office365.runtime.client_request_exception.ClientRequestException: ('-2147024891, System.UnauthorizedAccessException', 'Acceso denegado. No tiene So I guess the code it´s working correctly. Thank you for your help. |
That's right, steps 6-9 are also mandatory for granting permissions. |
Good Afternoon Finally we changed the XML and it´s working ctx = ClientContext.connect_with_credentials(site_url, ClientCredential(client_id, client_secret)) Web site title: NEGOCIO Thank you so much for all your help. |
@pobs93 I am trying to do the same thing. I change my permissions. but getting the same error as you were -2147024891, System.UnauthorizedAccessException', 'Access denied. You do not have permission to perform this action or access this resource.', '403 Client Error: Forbidden for url: did you change the permission XML ? did you change the scope here to reflect your company URL or keep it as is. ? |
Good Morning,
I have been trying for days to connect with my company Sharepoint account but I´m not able to do it.
I have tried the approaches explained in the pypi description
username = 'pablo@mycompany.com'
password = 'XXXX'
url = 'https://aXXX.sharepoint.com'
_ctx_auth = AuthenticationContext(url)
if ctx_auth.acquire_token_for_user(username, password):
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()_
Also the one given after the 2.1.8 version release
ctx = ClientContext.connect_with_credentials(site_url, UserCredential(username,password))
but I always get the same error:
An error occurred while retrieving token from XML response: AADSTS500069: The element with ID 'XXXX' was either unsigned or the signature was invalid.
An error occurred while retrieving auth cookies from https://XXX.sharepoint.com/_vti_bin/idcrl.svc
This is stopping me from continuing with my project...
Can anybody tell me why this error is occurring and how to fix it?
Thanks in advance.
The text was updated successfully, but these errors were encountered: