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
IndexError: list index out of range #304
Comments
Hello, <s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing"><s:Header><a:Action s:mustUnderstand="1">http://www.w3.org/2005/08/addressing/soap/fault</a:Action><a:RelatesTo>cfb81633-ff49-4e50-9544-7e39214d7122</a:RelatesTo></s:Header><s:Body><s:Fault><s:Code><s:Value>s:Sender</s:Value><s:Subcode><s:Value xmlns:a="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">a:InvalidSecurity</s:Value></s:Subcode></s:Code><s:Reason><s:Text xml:lang="fr-FR">An error occurred when verifying security for the message.</s:Text></s:Reason></s:Fault></s:Body></s:Envelope> |
Greetings! thank you for the detailed log, at the moment im lacking any possibility to verify it against SharePoint/ADFS env. @wreiner, maybe you could kindly confirm whether federated authentication is working as expected on your side for the latest release? |
Hi everyone I am having similar issues, the following line gives me a 400 or 500 response. Office365-REST-Python-Client/office365/runtime/auth/providers/saml_token_provider.py Line 133 in 020c8c8
In case I get the 400 response the body is empty resulting in a I have not yet gotten the package to work, so it could well be the sharepoint server, but I will try downgrading the package just to be sure. How can I ensure that sharepoint authentication is setup correctly? Thx in advance! |
Hi, I'm not at my computer to fully analyse but as I see it, when I install the latest version with pip the function acquire_service_token_from_adfs is missing from runtime/auth/providers/saml_token_provider.py. In my pull request there is no removal of this function so I'm not sure why it is missing. Also my fix for the datetime format is not in the file. Maybe there was an error with the merge? |
@wreiner thank you for getting back, regarding
its been refactored from public to private method.
the format should be in place as were committed originally, but its been refactored abit in terms of moving the declaration to
But if something is missing after the merge, i should be blamed. |
Hi Mark, thank you for confirming it, it indeed appears in the latest version federated authentication (SharePoint/ADFS) somewhat broken |
I'm not through complete analysis but for the my changes I can say they return the security token and cookie correctly but the cookie jar does not contain a 'FedAuth' field which is looked for in is_valid_auth_cookies which is now being used in _get_authentication_cookie. Office365-REST-Python-Client/office365/runtime/auth/providers/saml_token_provider.py Line 32 in 93325ea
For federated auth I only see SPOIDCRL in the jar. Currently I'm still unable to use the obtained auth data correctly, I'm still investigating but can't tell how long I'll need. All in all I can tell that with the old version and my patches everything still works fine as expected but unfortunately not with the new version. |
Thanks for the quick responses :-) @vgrem it get a similar error on version 2.2.2, so it seems to be the sharepoint server. It might be nice to wrap the exception into a more readable one. |
I am one step further. Turns out I needed to reset my password. I'm now hitting the same error as @wreiner. The Maybe I'll try version 2.2.2 again. |
I have the same issue. def is_valid_auth_cookies(values):
return True
# return any(values) and values.get('FedAuth', None) is not None |
Hey @hungnguyen95 , thank you for confirming it! Turns out |
Hello, I'm quite lost here sorry. I thought that my issue was in _acquire_service_token_from_adfs. Thanks in advance for your help. |
@guillaume-colas it seems that your issue is probably related to the server not allowing you access. Are you sure the password is correct and have you tried resetting your password? Resetting my password resolved this issue. After which I ran into the |
@mark-boer Yes I've verified my password and it's correct. Is it possible that's the authentification with 2FA (sms code) is blocking from authentificating? Is it possible to use ClientCredentials to upload files to sharepoint? Thanks in advance for your help |
Currently getting this error, password is correct and working for sharepy connections. Anything I should try? |
Having same issue with latest version (2.3.9), username and password which I'm using works well if I use old version (2.1.4) |
Hi, I think I have the same problem. I try to connect to sharepoint with python 3.8 (using Spyder). And also get 'IndexError: list index out of range'. I used the example given by https://pypi.org/project/office365-rest-client/. My username and password are correct. I am not very experienced so I thought the error meant I did something wrong. But do I understand correctly that this is a general issue? And is there any other way of fixing this, without using an older version? |
I am still receiving this error, any updates? Here is what I'm getting: |
Has anyone solved this issue? I have been struggling with it for a while. Even changed to |
It sounds mad. Everything works find until recently I changed my password, I started seeing this error and have problem connecting to SharePoint. After struggling with it for days, it turns out in my case it cannot handle some special characters in my password. I changed my password again, and it works fine now. I am using Office365-REST-Python-Client-2.3.11. |
This worked for me, thank you very much. The old password had a special character that was not recognized |
Hi did anyone reolved this issue. I am still seeing the same error |
Hi,
|
DEar Sir,
Could you please help me to find out why I'm not connecting to sharepoint anymore?
With version 2.2.2 everything was working fine.
Then issue #272 occured (An error occurred while retrieving token from XML response: AADSTS500069 ) so I upgraded to 2.3.0.1.
Now the following code doesn't work either:
def copy_sharepoint(self,filename=""):
ctx = ClientContext(self.SITE_SHAREPOINT).with_credentials(UserCredential(self.WIN_USER,self.WIN_PASSWORD))
localpath=os.path.join(self.CHEMIN_XLSX ,self.NOM_TIR + '/',self.FICHIER_BI)
self.print_debug("",localpath)
self.print_debug("",self.WIN_PASSWORD)
with open(localpath, 'rb') as content_file:
file_content = content_file.read()
file = ctx.web.get_folder_by_server_relative_url(self.CHEMIN_SHAREPOINT).upload_file(self.FICHIER_BI, file_content).execute_query()
Traceback (most recent call last):
File "/appli/sopra/tools/tir_bench.py", line 1327, in
tir_bench.copy_sharepoint()
File "/appli/sopra/tools/tir_bench.py", line 1278, in copy_sharepoint
file = ctx.web.get_folder_by_server_relative_url(self.CHEMIN_SHAREPOINT).upload_file(self.FICHIER_BI, file_content).execute_query()
File "/home/benchsp/.local/lib/python3.9/site-packages/office365/runtime/client_object.py", line 30, in execute_query
self.context.execute_query()
File "/home/benchsp/.local/lib/python3.9/site-packages/office365/runtime/client_runtime_context.py", line 138, in execute_query
self.pending_request().execute_query()
File "/home/benchsp/.local/lib/python3.9/site-packages/office365/runtime/client_request.py", line 73, in execute_query
self.beforeExecute.notify(request)
File "/home/benchsp/.local/lib/python3.9/site-packages/office365/runtime/types/EventHandler.py", line 18, in notify
listener(*args, **kwargs)
File "/home/benchsp/.local/lib/python3.9/site-packages/office365/sharepoint/client_context.py", line 162, in _build_modification_query
self.ensure_form_digest(request)
File "/home/benchsp/.local/lib/python3.9/site-packages/office365/sharepoint/client_context.py", line 123, in ensure_form_digest
self.request_form_digest()
File "/home/benchsp/.local/lib/python3.9/site-packages/office365/sharepoint/client_context.py", line 130, in request_form_digest
response = self.execute_request_direct(request)
File "/home/benchsp/.local/lib/python3.9/site-packages/office365/runtime/client_runtime_context.py", line 134, in execute_request_direct
return self.pending_request().execute_request_direct(request)
File "/home/benchsp/.local/lib/python3.9/site-packages/office365/runtime/odata/odata_request.py", line 34, in execute_request_direct
return super(ODataRequest, self).execute_request_direct(request)
File "/home/benchsp/.local/lib/python3.9/site-packages/office365/runtime/client_request.py", line 86, in execute_request_direct
self.context.authenticate_request(request_options)
File "/home/benchsp/.local/lib/python3.9/site-packages/office365/sharepoint/client_context.py", line 151, in authenticate_request
self._auth_context.authenticate_request(request)
File "/home/benchsp/.local/lib/python3.9/site-packages/office365/runtime/auth/authentication_context.py", line 84, in authenticate_request
self._provider.authenticate_request(request)
File "/home/benchsp/.local/lib/python3.9/site-packages/office365/runtime/auth/providers/saml_token_provider.py", line 73, in authenticate_request
self.ensure_authentication_cookie()
File "/home/benchsp/.local/lib/python3.9/site-packages/office365/runtime/auth/providers/saml_token_provider.py", line 80, in ensure_authentication_cookie
self._cached_auth_cookies = self.get_authentication_cookie()
File "/home/benchsp/.local/lib/python3.9/site-packages/office365/runtime/auth/providers/saml_token_provider.py", line 93, in get_authentication_cookie
token = self._acquire_service_token_from_adfs(user_realm.STSAuthUrl)
File "/home/benchsp/.local/lib/python3.9/site-packages/office365/runtime/auth/providers/saml_token_provider.py", line 136, in _acquire_service_token_from_adfs
assertion_node = dom.getElementsByTagNameNS("urn:oasis:names:tc:SAML:1.0:assertion", 'Assertion')[0].toxml()
IndexError: list index out of range
Could you please help me with that issue?
Thanks in advance,
Guillaume
The text was updated successfully, but these errors were encountered: