A few days ago, I had to configure Thunderbird on a Linux machine, as a client for Gmail. The associated Google account was a G Suite one. As I already went through Thunderbird configuration for Gmail some months ago and did not face any trouble, I was not expecting any difficulty for this new configuration operation. Even if the new operation was for a G Suite account, while the previous one was for a free account...
Actually, a problem rapidly appeared: Thunderbird was not able to connect to the email server. It was keeping on displaying a truncated error message, at every account information validation attempt:
Alert from account <myEmailAddress> - Please log in via your web browser: https://support...
I tried several actions, as advised by Google help: define an application password, activate two-step verification, change my password and ensure I was using the right one... But the error was still here.
So I decided to get more information about it. From a terminal, I entered the following command, to perform an IMAP authentication:
openssl s_client -connect imap.gmail.com:993 -crlf
This command returned the Gmail prompt, after certificates data and some other information:
* OK Gimap ready for requests from 86.203.170.159 d13mb162487948wrj
I tried to login:
a LOGIN "<myEmailAddress>" "<myPassword>"
and got following error message back:
* NO [WEBALERT https://accounts.google.com/signin/continue?sarp=1&scc=1&plt=<veryLongString>] Web login required.
a NO [ALERT] Please log in via your web browser: https://support.google.com/mail/accounts/answer/78754 (Failure)
And this reminded me something: while testing various possible account configurations in Thunderbird, I had seen that Gmail was accepting OAuth2 as authentication method. I selected this method. And bingo! Thunderbird connection was accepted.