mguessan / davmail

DavMail POP/IMAP/SMTP/Caldav/Carddav/LDAP Exchange and Office 365 Gateway - Synced with main subversion repository at
http://davmail.sourceforge.net
GNU General Public License v2.0
582 stars 86 forks source link

Started getting "refresh token failed" a week ago #292

Closed JohnAntoine closed 4 months ago

JohnAntoine commented 1 year ago

OS: Arch Linux Mail Client: Thunderbird 102.12.0 DavMail 6.1.0 davmail.mode O365Manual

Error: ERROR [ImapConnection-35764] davmail.exchange.auth.O365Token - refresh token failed javax.crypto.BadPaddingException: Given final block not properly padded. Such issues can arise if a bad key is used during decryption.

I have 3 different exchange accounts connected, and all three exhibit this behavior.

JohnAntoine commented 1 year ago

Update: The issue was resolved by removing all accounts using Davmail along with their OAuth token, then adding everything again from scratch.

However, it would be preferable to find out why this happened and prevent it in the future.

Update 2: Since I removed all Exchange accounts and added them again, I have to manually re-authenticate once per reboot.

Any help with this issue would be appreciated.

mguessan commented 1 year ago

Sorry for the delay, I can answer on first issue: refresh token stored by DavMail is encrypted with client provided password over IMAP, Caldav, ... Thus the root cause of the BadPaddingException above is that one client had a wrong password stored.

On your other issue I see two possible source: