If Thunderbird and Firefox cannot connect to Gmail
You may have been able until now to connect to your Gmail account with Firefox and Thunderbird (imap), yet suddenly you receive error alerts, that your password is not valid!
If you have not changed anything in the configuration of Firefox, Thunderbird and Gmail itself, here is what you can try.
Open Firefox and go to Options > Privacy. Clear Firefox cache and offline data, and also remove google cookies related with your gmail account (accounts.google cookies).
In most cases if you clear these Firefox data, gmail accounts work again without problems, even in Thunderbird.