I did a quick test with my wife’s school google e-mail and didn’t work for me either. I googled around and found that gmail doesn’t support plain imap anymore. (https://support.google.com/accounts/answer/6010255)
It appears you can set up a specific “app password”:
Instead you can enable 2-step verification in your Google account security settings (https://support.google.com/accounts/answer/185839), then generate an application password to use instead of your regular account password (https://support.google.com/accounts/answer/185833). – from https://support.google.com/mail/thread/221127207/
I’m not able to test that right now (I can’t muck up my wife’s work e-mail) but I will give it a bash as soon as I can.