shareplum
shareplum copied to clipboard
Error authenticating against Office 365. Error from Office 365:
Hello everyone, I'm trying to upload some files to SharePoint in Office 365 but the authentication fails even though that I put the right credentials.Here's the code:
from shareplum import Site
from shareplum import Office365
from shareplum.site import Version
#get all the csv files
csv_files = list(filter(lambda x: '.csv' in x, os.listdir('./csvfiles')))
# Office 365 Authentication
authcookie = Office365('https://tenant.sharepoint.com',
username='[email protected]', password='password').GetCookies()
site = Site('https://tenant.sharepoint.com/sites/Folder',
version=Version.v365, authcookie=authcookie)
However, I do manage to log in and upload data with my personal account, but I can’t upload data with my organizational account Here’s the message error when I try to log with my organizational account:
raise Exception('Error authenticating against Office 365. Error from Office 365:', message[0].text)
Exception: ('Error authenticating against Office 365. Error from Office 365:', 'AADSTS50126: Error validating credentials due to invalid username or password.')
Is there any way to fix it?
Thanks in advance
Do you have any strange characters in your user name or password? The Office365 authentication user xml.sax.saxutils.escape() to clean up special characters, but maybe it is interfering?
Do you have any special characters in your username and password?
On Wed, Apr 15, 2020 at 8:43 AM Odair Vaz [email protected] wrote:
Hello everyone, I'm trying to upload some files to SharePoint in Office 365 but the authentication fails even though that I put the right credentials.Here's the code.
` from shareplum import Site from shareplum import Office365 from shareplum.site import Version
#get all the csv files csv_files = list(filter(lambda x: '.csv' in x, os.listdir('./csvfiles'))) Office 365 Authentication
authcookie = Office365('https://tenant.sharepoint.com', username='[email protected]', password='password').GetCookies() site = Site('https://tenant.sharepoint.com/sites/Folder', version=Version.v365, authcookie=authcookie) ` However, I do manage to log in and upload data with my personal account, but I can’t upload data with my organizational account Here’s the message error when I try to log with my organizational account:
raise Exception('Error authenticating against Office 365. Error from Office 365:', message[0].text)
Exception: ('Error authenticating against Office 365. Error from Office 365:', 'AADSTS50126: Error validating credentials due to invalid username or password.')
Is there any way to fix it?
Thanks in advance
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/jasonrollins/shareplum/issues/84, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAOVTVRFFTXIOEX6N4MJ3R3RMW2YDANCNFSM4MISYCVQ .
I'm having the same issue, and no special characters are observed in my username and password. Can you please help?
Can you try version 0.4.5 and see if that one works?
Tried with 0.4.5 and the error is still the same.
please help
Try setting verify_ssl=False in your site object. Site(verify_ssl=False)
On Tue, Apr 28, 2020, 1:00 AM vennamanand1 [email protected] wrote:
please help
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/jasonrollins/shareplum/issues/84#issuecomment-620398391, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAOVTVT7TB4U33PTW6XQASDROZWJNANCNFSM4MISYCVQ .
Do you have any strange characters in your user name or password? The Office365 authentication user xml.sax.saxutils.escape() to clean up special characters, but maybe it is interfering?
no, my password and username doesn't have stange characters
I changed my code but i'm still having the same issue
from shareplum import Site
from shareplum import Office365
from shareplum.site import Version
#get all the csv files
csv_files = list(filter(lambda x: '.csv' in x, os.listdir('./csvfiles')))
# Office 365 Authentication
authcookie = Office365('https://tenant.sharepoint.com',
username='[email protected]', password='password').GetCookies()
site = Site('https://tenant.sharepoint.com/sites/Folder',
version=Version.v365, authcookie=authcookie, verify_ssl=False)
But i keep having the same error
Traceback (most recent call last):
File "rest-api.py", line 19, in <module>
authcookie = Office365('https://tenant.sharepoint.com',
File "C:\Users\username\AppData\Local\Programs\Python\Python38-32\lib\site-packages\shareplum\office365.py", line 87, in get_cookies
sectoken = self.get_security_token(self.username, self.password)
File "C:\Users\username\AppData\Local\Programs\Python\Python38-32\lib\site-packages\shareplum\office365.py", line 79, in get_security_token
raise Exception('Error authenticating against Office 365. Error from Office 365:', message[0].text)
Exception: ('Error authenticating against Office 365. Error from Office 365:', 'AADSTS50126: Error validating credentials due to invalid username or password.')
I'm having a similar issue (tried 0.5.0 and 0.4.5)
from shareplum import Site
from shareplum import Office365
from shareplum.site import Version
authcookie = Office365('https://abc.sharepoint.com', username=username, password=password).GetCookies()
site = Site('https://abc.sharepoint.com/sites/MySharePointSite/', version=Version.v365, authcookie=authcookie, verify_ssl=False)
with this error:
Exception: ('Error authenticating against Office 365. Was not able to find an error code. Here is the SOAP response from Office 365'
It appears it can't get a security token.
I am also facing a similar issue.
The code I used.
from shareplum import Site
from shareplum import Office365
from shareplum.site import Version
authcookie = Office365('https://***.sharepoint.com/', username='***', password='***').GetCookies()
site = Site('https://***.sharepoint.com/sites/Folder/', version=Version.v2016, authcookie=authcookie)
folder = site.Folder('Shared Documents/ME/')
folder.get_file('xyz.xlsx')
And the error I am facing is.
File "***\shareplum\office365.py", line 80, in get_security_token
raise Exception('Error authenticating against Office 365. Error from Office 365:', message[0].text)
Exception: ('Error authenticating against Office 365. Error from Office 365:', "AADSTS50076: Due to a configuration change made by your administrator, or because you moved to a new location, you must use multi-factor authentication to access ''.")
@jasonrollins can you help us with this issue, do you have any other suggestion ? thanks
I was able to use this work around to pull data from the file I needed with requests_ntlm. My goal was to download the original file, but this will have to do. Accessing SharePoint 2013...
from requests_ntlm import HttpNtlmAuth
import requests
from io import BytesIO
auth = HttpNtlmAuth(username = username,
password = password)
responseObject = requests.get(url, auth = auth)
file = BytesIO(responseObject.content)
df = pd.read_excel(file)
I also had this error
raise Exception('Error authenticating against Office 365. Error from Office 365:', message[0].text) Exception: ('Error authenticating against Office 365. Error from Office 365:', 'AADSTS50126: Error validating credentials due to invalid username or password.')
@jasonrollins It would be great if you can help us here.
Hi all,
Facing this error too - 'Error authenticating against Office 365. Error from Office 365:', 'AADSTS50126: Error validating credentials due to invalid username or password.'
Credentials works just fine if I try to login directly into SP or if I use my company email. But using the service account email, I can't pass that error.
Any help would be appreciated.
Apologies. I'm not really sure how to debug logins. Some people have issues with their sites and some don't. I only have access to a personal Office 365 sharepoint site so I'm limited by what I can test.
On Fri, Oct 2, 2020 at 2:55 PM Nuno Tavares [email protected] wrote:
Hi all,
Facing this error too - 'Error authenticating against Office 365. Error from Office 365:', 'AADSTS50126: Error validating credentials due to invalid username or password.'
Credentials works just fine if I try to login directly into SP or if I use my company email. But using the service account email, I can't pass that error.
Any help would be appreciated.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jasonrollins/shareplum/issues/84#issuecomment-702929449, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAOVTVUTRB7RVNUDOHHREPLSIYV4RANCNFSM4MISYCVQ .
@jasonrollins The issues seems to be because of multi-factor authentication(such as okta) implemented on Office 365. I believe you are not facing this issue since your Office 365 has single-point authentication.
So I guess the question is how do we account for multi-factor authentication?
So I guess the question is how do we account for multi-factor authentication?
I vote for closing this issue. Multi-factor authentication has been created to prevent automated login. If someone wants to automate data storage in SharePoint then they should ask IT Team to create exception for the login account. Trying to solve multi-factor authentication could be out of scope of your work.
Exception: ('Error authenticating against Office 365. Error from Office 365:', 'AADSTS50034: The user account {EmailHidden} does not exist in the gmail.com directory. To sign into this application, the account must be added to the directory.')
Same problem and I confirm there isn't multi-factor authentification
Exception: ('Error authenticating against Office 365. Error from Office 365:', 'AADSTS50034: The user account {EmailHidden} does not exist in the gmail.com directory. To sign into this application, the account must be added to the directory.')
Same problem and I confirm there isn't multi-factor authentification
Same issue to me.
Hello, guys, anyone can solve this issue? I also facing this issue:
raise Exception('Error authenticating against Office 365. Error from Office 365:', message[0].text) Exception: ('Error authenticating against Office 365. Error from Office 365:', 'AADSTS90023: Invalid STS request.')
So is there just no way to use SharePlum on a SharePoint site that requires MFA? Is there no way to call the prompt to ask the user to login using MFA?
This is my code. Who can solve this problem
from shareplum import Site from shareplum import Office365 from shareplum.site import Version
Office 365 Authentication
authcookie = Office365('https://xxxx.sharepoint.com/', username='[email protected]', password='xxxxxxxx').GetCookies()
print(authcookie) site = Site('https://xxxxx.sharepoint.com/sites/site2', version=Version.v365, authcookie=authcookie, verify_ssl=False)
dir = 'Shared Documents\test' f = site.Folder(dir)
for file in f.files: print('--------') print(file) d = f.get_file(file['Name']) print(d)
for folder in f.folders: print(folder)
I am getting the same error, anyone has any solution?
Even I'm facing Exception: ('Error authenticating against Office 365. Was not able to find an error code. Here is the SOAP response from Office 365.
is there any solution?
same error for me too... but not progressive way on that...
I am getting the same error pls hep me on this. Thanks
Stuck with the same issue and looking for a solution.. Thanks..
same issue here as well. IT said they will not remove MFA either. Has anyone found a different library?