Google was going to turn off access for LSA apps soon, and this includes IMAP for Gmail. However, with the pandemic they delayed this indefinitely.
https://gsuiteupdates.googleblog.com/2020/03/less-secure-app...
Since May 1st, using IMAP to access a G Suite account stopped working, though, with a message:
> IMAP command 'AUTHENTICATE PLAIN <authdata>' returned an error: NO [AUTHENTICATIONFAILED] Invalid credentials (Failure)
I know the credentials are good because they work in the browser. Maybe an automated process somewhere kicked in?
[1] https://support.google.com/mail/answer/185833?hl=en