OfflineIMAP / offlineimap

Read/sync your IMAP mailboxes (python2) [LEGACY: move to offlineimap3]
http://www.offlineimap.org
Other
1.78k stars 360 forks source link

Yahoo authentication fail #688

Closed skempf closed 3 years ago

skempf commented 3 years ago

I cannot fetch mail from Yahoo, because after 2020-10-20, they require "an updated secure sign-in". A few issues here mention OAUTH2 with GMail, but that doesn't seem to be the issue. Is there a way to still interface with Yahoo mail?

General information

Configuration file offlineimaprc

[Account Yahoo]
localrepository = Yahoo-local
remoterepository = Yahoo-remote

[Repository Yahoo-local]
type = Maildir
localfolders = *******

[Repository Yahoo-remote]
auth_mechanisms = GSSAPI, CRAM-MD5, PLAIN, LOGIN
type = IMAP
ssl = yes
remoteport = 993
remotehost = imap.mail.yahoo.com
remoteuser = *******
remotepasseval = *******
sslcacertfile = /etc/ssl/certs/ca-certificates.crt
maxconnections = 1
realdelete = True
folderfilter = lambda foldername: foldername in ['Inbox', ]
nametrans = lambda foldername: re.sub('^Inbox', 'Yahoo', foldername)

Logs, error

 Establishing connection to imap.mail.yahoo.com:993 (Yahoo-remote)
 PLAIN authentication failed: [AUTHENTICATIONFAILED] AUTHENTICATE Invalid credentials
 LOGIN authentication failed: [AUTHENTICATIONFAILED] LOGIN Invalid credentials
 ERROR: All authentication types failed:
    PLAIN: [AUTHENTICATIONFAILED] AUTHENTICATE Invalid credentials
    LOGIN: [AUTHENTICATIONFAILED] LOGIN Invalid credentials
 *** Finished account 'Yahoo' in 0:08
ERROR: Exceptions occurred during the run!
ERROR: All authentication types failed:
    PLAIN: [AUTHENTICATIONFAILED] AUTHENTICATE Invalid credentials
    LOGIN: [AUTHENTICATIONFAILED] LOGIN Invalid credentials

Traceback:
  File "/usr/share/offlineimap/offlineimap/accounts.py", line 283, in syncrunner
    self.__sync()
  File "/usr/share/offlineimap/offlineimap/accounts.py", line 359, in __sync
    remoterepos.getfolders()
  File "/usr/share/offlineimap/offlineimap/repository/IMAP.py", line 452, in getfolders
    imapobj = self.imapserver.acquireconnection()
  File "/usr/share/offlineimap/offlineimap/imapserver.py", line 586, in acquireconnection
    self.__authn_helper(imapobj)
  File "/usr/share/offlineimap/offlineimap/imapserver.py", line 459, in __authn_helper
    "failed:\n\t%s"% msg, OfflineImapError.ERROR.REPO)

Steps to reproduce the error

mbucas commented 3 years ago

The simplest way to make it work again is to use what they call an "application password" somewhere in the parameters.

skempf commented 3 years ago

Thanks. Interesting that their app password has less entropy than my original. I also tried to look through Thunderbird's source to see how they overcome this issue, but without any clarity. Thanks for the information @mbucas.