Getting Invalid Credentials on Live Server(Cpanel) while reading Outlook mailbox but works on local server
adnanrafique opened this issue · 3 comments
Describe the bug
I am using exchangelib to read Outlook mailbox and download attachments from there. On local server I enter my email and regular password, it authenticates and does the job. But when I deployed it to cpanel hosting, it does not authenticate the email and regular password. Password is correct, I have tried using it in browser and it is valid. I turned on 2fa and used an app password on live, it works fine. But I want to use a regular password since my application users won't follow all those steps to generate an App Password. How can I use it regular password on live server? Is it something to with exchangelib or Microsoft issue?
To Reproduce
Here is my code
credentials = Credentials(email_address, password)
account = Account(email_address, credentials=credentials, autodiscover=True, access_type=DELEGATE)
inbox = account.inbox
Expected behavior
It should authenticate the login using regular password on live server too like it is doing on local server
Log output
An error occurred: Invalid credentials for https://outlook.com/autodiscover/autodiscover.svc
Additional context
Python 3.9.16
Exchangelib 5.1.0
Are you connecting to an on-prem server with username/password when it works? And an Office365 account when it doesn't? If so, then it's because Microsoft disabled Basic auth on Office365 so you have to use OAuth to connect.
If you're connecting to the same server, but from inside and outside the corporate network, then probably your Exchange admins disabled Basic auth from external IP addesses. You'll have to talk to your Exchange admins if you want that changed.
Closing. Feel free to reopen if you get back to this.