Bug: Can't login to Gmail with OAuth2, unsupported browser error.  (solved by setting "general.useragent.compatMode.firefox = True")
Status: UNCONFIRMED
Priority: --
Created: 2022-04-22 21:36:20+00:00
Resolved: 2024-11-04 04:12:14+00:00

User Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:99.0) Gecko/20100101 Firefox/99.0

Steps to reproduce:

See https://support.mozilla.org/en-US/questions/1374493#answer-1499359

I have 5 Gmail accounts that I manage for different family members.  All accounts in Thunderbird access Gmail via IMAP, and are configured to login with OAuth2.

Last week, Google removed Thunderbird access from 2 of the accounts, I do not know why.  When I login to those accounts via the web in Firefox, Thunderbird was no longer listed under their 3rd party access.  The other 3 accounts are fine.


Actual results:

I am having the same issue as reported in these posts:

https://support.mozilla.org/en-US/questions/1343530
https://support.mozilla.org/en-US/questions/1344530
https://support.mozilla.org/en-US/questions/1350244.

1 of the failing accounts does not have 2FA enabled. I was able to re-login with Thunderbird when prompted, and I was presented with a window to grant Thunderbird access, which worked, no problem.  So Thunderbird's browser was clearly recognized by Gmail.

But the other failing account does have 2FA enabled, and that is where the problem lies.  Thunderbird prompts for login, and the username and password are accepted, but when I enter the 2FA verification code, Thunderbird presents a window saying "Your browser is not supported anymore. Please update to a more recent one." (bug 1677845).  There is no option presented to grant access to Thunderbird.  Yet, the verification did work, because the browser shows me as logged in, and my primary email receives notification that the account was logged in from a new device.

See attached screenshots.

For the record, the failing 2FA account is managed by Family Link (the other non-2FA account is not).  According to https://support.google.com/mail/thread/127545584/, such accounts cannot login to email clients.  But that has never been a problem before, and 1 of the other still-working accounts in Thunderbird is also managed by Family Link and works just fine, so that can't be the culprit.

Also, I do have AVG installed with Email Shield enabled, but disabling that makes no difference.

Thunderbird's UserAgent is "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1".  And yes, cookies are enabled in both Thunderbird and Firefox.

Is there a way to get Thunderbird to use Firefox properly for Gmail login, instead of its own integrated browser?

I wonder, could this have anything to do with Thunderbird requesting a "legacy" OAuth URL, even though the account is set to use OAuth2?

As you can see in the attached screenshots, Thunderbird is logging in using the URL "https://accounts.google.com/signin/oauth/legacy/...", which is NOT the URL described in Google's OAuth2 documentation (https://accounts.google.com/o/oauth2/v2/auth, and https://oauth2.googleapis.com/token).


Expected results:

I expected the browser used to be recognized by Google, and the 2FA OAuth2 login to be fully successful so Thunderbird can access the account.