Office365-rest-python-client: Authentication Problems

Created on 21 Jun 2018  ·  7Comments  ·  Source: vgrem/Office365-REST-Python-Client

Hi,

I use sharepoint in Cloud and from yesterday I have an authentication error: "An error occurred while retrieving token: AADSTS70002: Error validating credentials. AADSTS50126: Invalid username or password. An error occurred while retrieving auth cookies"

Do you have some similar issues? It's a problem of Azure AD??

many thanks for support

Andrea

All 7 comments

Are you using the method acquire_token_for_user(usernameg, password)?
If so, the password param is not the password you log in sharepoint, but the office 365 app id.

@DuiduiLi until June 20, I carried out the authentication to a site sharepoint with username and password, so now I have to register an office 365 app connected to the site sharepoint? correct?

Resolved. The issue was the use of a company user, for which a check is performed, only via browser, between Azure Active Directory and internal Active Direcotry. For the batch script, I have created a user in the cloud AAD.

Are you using the method acquire_token_for_user(usernameg, password)?
If so, the password param is not the password you log in sharepoint, but the office 365 app id.

Can you explain what is meant by office 365 app id?

@Cesaaar @DuiduiLi @Matt-Duke @jimr @mirontoli
is the Solution the error thread is creating new account in Cloud.
What is the issue using company id, where any permission require to provide in Organisation side.

@DuiduiLi until June 20, I carried out the authentication to a site sharepoint with username and password, so now I have to register an office 365 app connected to the site sharepoint? correct?

Can you please elaborate on what is office365 app id. i also have the same error when using acquire_token_for_user(usernameg, password) with my SP login id and password. Thanks in advance

when I am trying to execute following code I am getting error

from office365.runtime.auth.authentication_context import AuthenticationContext
from office365.sharepoint.client_context import ClientContext
url = ""
ctx_auth = AuthenticationContext(url)
ctx_auth.acquire_token_for_user("username", "password")
ctx = ClientContext(url, ctx_auth)
print(ctx)
Error is
AttributeError: 'NoneType' object has no attribute 'text'

Was this page helpful?
0 / 5 - 0 ratings