question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error authenticating against Office 365. Error from Office 365:

See original GitHub issue

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='login@tenant.com', 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

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:2
  • Comments:32 (5 by maintainers)

github_iconTop GitHub Comments

4reactions
divy-workscommented, Feb 2, 2021

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.

3reactions
jasonrollinscommented, Apr 28, 2020

Try setting verify_ssl=False in your site object. Site(verify_ssl=False)

On Tue, Apr 28, 2020, 1:00 AM vennamanand1 notifications@github.com 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 .

Read more comments on GitHub >

github_iconTop Results From Across the Web

python - Exception: Error authenticating against Office 365 ...
I trying to download the files from Microsoft office ...
Read more >
Access Denied when you connect to Microsoft 365 - Office 365
To fix this problem, reset the user's password. To do this, follow these steps: Open a web browser, browse to the Microsoft 365...
Read more >
FIX: Outlook Authentication with Office 365 Fails. (Solved)
So, the first method to solve the authentication issue to Office 365, in Office desktop applications, is to install the Missing Packages for...
Read more >
When I try to "Sign in with Microsoft" I am getting a "Cannot ...
Ensure the Username and Primary email address fields match in the Microsoft admin settings. · The Office 365 email admin needs to enable...
Read more >
Office 365: Unable to Authenticate Your Credentials
How to Fix Office 365 Credential Authentication Errors · 1. Enable TLS 1.2 · 2. Check your user name format · 3. Disable...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found