-
-
Notifications
You must be signed in to change notification settings - Fork 317
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
Error in acquire_token_for_user #156
Comments
I have got the exact same issue |
Same, this just popped up, can't access share point anymore. |
I have the same issue and can't access to the enterprise sharepoint. In other issue (#76 , at 5 Aug 2018) shows the next solution (that did not works for me yet):
Actually, i have my user in the AAD, but i still can't access :( any solution/clue? |
My code works: |
It works for me too. The URL can also be something like "https://mycompany.sharepoint.com/sites/AnotherSite" or "https://mycompany.sharepoint.com/sites/AnotherSite/Subsite" Try with this code instead: from office365.runtime.auth.authentication_context import AuthenticationContext
from office365.runtime.client_request import ClientRequest
from office365.runtime.utilities.request_options import RequestOptions
user_credentials = {
'username' : 'my_user@domain.com',
'password' : 'my_password'
}
site_url = "https://mycompany.sharepoint.com/"
ctx_auth = AuthenticationContext(site_url)
if ctx_auth.acquire_token_for_user(user_credentials['username'], user_credentials['password']):
request = ClientRequest(ctx_auth)
options = RequestOptions("{0}/_api/web/lists".format(site_url))
options.set_header('Accept', 'application/json')
options.set_header('Content-Type', 'application/json')
data = request.execute_request_direct(options)
s = json.loads(data.content) |
Hey Mark, @KasperSvendsen and @fpinab, just a small update, since you mentioned:
i believe you refer to Office 365 Single Sign-On for ADFS scenario, this flow was not supported and that's probably the reason why the provided error occurred. The good news, the support for SAML-based federated authentication with SharePoint Online has been introduced in version Prerequisites It is assumed Multi-factor authentication for a user is disabled Notes
Cheers, |
@vgrem
below is the log:
|
@vgrem I have the same issue. The below code returns the error "An error occurred while retrieving auth cookies from https://company.sharepoint.com/_vti_bin/idcrl.svc" I have 2.1.7.post1 installed as well but I do not have admin access to check on the multi factor authentification. from office365.runtime.auth.authentication_context import AuthenticationContext url = 'https://company.sharepoint.com' ctx_auth = AuthenticationContext(url) if ctx_auth.acquire_token_for_user(username, password): |
Hello,
I tried to connect to my intranet Sharepoint portal with Office365-REST-Python-Client, but it fails when calling acquire_token_for_user() from the AuthenticationContext class:
triggers the following error:
Regards,
Mark
The text was updated successfully, but these errors were encountered: