Skip to content
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

An error occurred while retrieving token: AADSTS50126: Error validating credentials due to invalid username or password. #170

Closed
bansalpulkit opened this issue Feb 14, 2020 · 1 comment

Comments

@bansalpulkit
Copy link

Hi

i am running the below code and get an error for invalid credentials:
from office365.runtime.auth.authentication_context import AuthenticationContext
from office365.sharepoint.client_context import ClientContext

site_url = 'url'
username = '[email protected]'
password = 'Password'

ctx_auth = AuthenticationContext(url = site_url)
if ctx_auth.acquire_token_for_user(username, password):
ctx = ClientContext(site_url, ctx_auth)
else:
print(ctx_auth.get_last_error())

I believe this might be due to my organization using SSO with Okta for SharePoint authentication, is there a way to fix the issue.

Thanks
Pulkit

@vgrem
Copy link
Owner

vgrem commented Feb 21, 2020

Greetings!

The support for SAML-based federated authentication with SharePoint Online has been added (version 2.1.7 or above) meaning it should work as expected now with Okta identity provider.
If not, please report back.

Note: since the new version has not yet been released to PyPi, it needs to be installed from GitHub instead at the moment, for example:

pip install git+https://github.com/vgrem/Office365-REST-Python-Client.git

Vadim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants