Too bad that most megacorp email providers no longer allow you to use just IMAP. Instead there's a bastardized OAuth2.0 (not good like Oauth1 was) toolkit they use for requiring HTTP(s) mediated authorization. Just IMAP will not work. And every megacorp's implementation of this is different so they have to be handled by slightly different plugins/etc.
The megacorps are trying real hard to kill off open protocols and switch everyone over to their in house "versions" of a public protocol for making proprietary protocols.
If you use this proxy of mine then any IMAP (or POP/SMTP) client can be used with a “modern” email provider, regardless of whether it supports OAuth 2.0 natively: https://github.com/simonrob/email-oauth2-proxy. No need for your client to know about OAuth at all.