Office365-rest-python-client: Auth error with 2.1.7

Created on 3 Mar 2020  ·  13Comments  ·  Source: vgrem/Office365-REST-Python-Client

I constantly get the below error while trying to connect to SharePoint,

An error occurred while retrieving auth cookies from https://xxxx.sharepoint.com/sites/xxxx//_forms/default.aspx?wa=wsignin1.0

question

Most helpful comment

Hi, can you also push new release to PyPI? It still has version 2.1.7.post1
https://pypi.org/project/Office365-REST-Python-Client/#history

Thx.

All 13 comments

Greetings!

@asukumar91, could you please share some details regarding the error, are you utilizing user credentials flow:

if ctx_auth.acquire_token_for_user(username, password):
  ctx = ClientContext(url, ctx_auth)

If yes, is multi-factor authentication enabled for this account?

Have you tried with _client credentials_ instead(refer Granting access using SharePoint App-Only on how to configure app-only principal):

if ctx_auth.acquire_token_for_app(client_id, client_secret):
  ctx = ClientContext(url, ctx_auth)

I have the same issue when trying to authenticate by using user credentials flow acquire_token_for_user for an user without multi-factor authentication and this user on the same tenant could authenticate without problem some weeks ago.

image

Version 2.1.6 works without errors.

I am have this exact issue with version 2.1.7. Have had to revert back to 2.1.6 for the time being.

This appears to be a change on the python client side, by hardcoding the authentication URL I was able to get it to work.
Change https://github.com/vgrem/Office365-REST-Python-Client/blob/master/office365/runtime/auth/saml_token_provider.py#L192 to use a URL of 'https://company-name.sharepoint.com/_forms/default.aspx?wa=wsignin1.0'

Until this is fixed I will be reverting back to 2.1.5. pip install Office365-REST-Python-Client==2.1.5

@vgrem I'm getting the same issue... this is blocking


(Pdb++) session.post(self.__sts_profile.signInPageUrl, data=security_token, headers={'Content-Type': 'application/x-www-form-urlencoded'})
(Pdb++) self.sts_profile.signInPageUrl
'https://XXX.sharepoint.com/sites/YYY/_forms/default.aspx?wa=wsignin1.0'

Greetings!

I believe the error should no longer occur with a new release

Hi, can you also push new release to PyPI? It still has version 2.1.7.post1
https://pypi.org/project/Office365-REST-Python-Client/#history

Thx.

@vgrem you should fine a way to automatize the upload of package after release

meanwhile package is released we can use https://pypi.org/project/office365-rest-client/

Good Afternoon,

I´ve been trying to connect to my Sharepoint account for days and it has been impossible.

I have tried all the versions relased from 2.1.5. untill the actual 2.1.9, and I always get the same error.

**_An error occurred while retrieving token from XML response: AADSTS500069: The element with ID 'XXX' was either unsigned or the signature was invalid.

An error occurred while retrieving auth cookies from https://XXX.sharepoint.com/_vti_bin/idcrl.svc_**

Does anybody know how to fix this error? I´ve been trying everything and I can´t make it work

Thanks.

I am having the same issue "error occurred while retrieving token from XML response: AADSTS500069: The element with ID...XXX was either unsigned or the signature was invalid" with version 2.1.9.

Thanks.

Hello,

I recomend you to follow the steps of this post, #207

I had this error and now it´s fixed

Regards

Hi,

I am able to solve the error AADSTS500069 by following steps on #207.

Thanks a lot!

Was this page helpful?
0 / 5 - 0 ratings