You can't use App passwords with Multi factor.
Your app will need to support modern auth
https://learn.microsoft.com/en-us/azure/active-directory/authentication/howto-mfa-app-passwords
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I am trying to connect my outlook using python. I have turned on the 2-factor authentication and created a new app password. I am unable to login. Please help to resolve this issue.
host = 'outlook.office365.com'
username = '#account#'
password = '#app password#'
mail = imaplib.IMAP4_SSL(host, port=993)
mail.login(username, password)
raise self.error(dat[-1])
imaplib.error: b'LOGIN failed.'
Please help to resolve this.
You can't use App passwords with Multi factor.
Your app will need to support modern auth
https://learn.microsoft.com/en-us/azure/active-directory/authentication/howto-mfa-app-passwords