Imaplib login with iCloud account refused as not authorized
Imaplib login with my iCloud account is refused, as not authorized, but login with other imap accounts, even on me.com are accepted. The user and passwords are correct.
The only difference is that the refused account is used in the settings as main account of iCloud, iCloud Drive etc...
Do you see an explanation?
If you want to access the mails of your Apple iCloud Mail id, via an iMap application différent of the standard Apple Mail app, and if your Apple ID is secured by a 2-step auth, you need to define your app in the Apple ID as explained here