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.