This site will have limited functionality while we undergo maintenance to improve your experience. If an article doesn't solve your issue and you want to ask a question, we have our support community waiting to help you at @FirefoxSupport on Twitter and/r/firefox on Reddit.

Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

Cannot add Gmail to Thunderbird, "Unable to log in at server"

  • 9 cavab
  • 2 have this problem
  • 13 views
  • Last reply by Matt

more options

I am trying to migrate from Mailspring to Thunderbird, yet have problems with adding my Google/Gmail accounts.

When I try to add a new account with my email and password, Thunderbird detects the IMAP details as follows: INCOMING SERVER Protocol: IMAP Hostname: imap.gmail.com Port: 993 Connection security: SSL/TLS Authentication method: OAuth2 Username: <my email>

OUTGOING SERVER Hostname: smtp.gmail.com Port: 465 Connection security: SSL/TLS Authentication method: OAuth2 Username: <my email>

When I then try to connect, I get the Google sign in popup, where I re-enter my password and grant the access via 2FA. Then, the screen to give Thunderbird read/write permissions for mail, calendar, etc. appears, I click "Allow", the popup closes and Thunderbird tells me: "Unable to log in at server. Probably wrong configuration, username or password."

I have checked other help articles; cookies are allowed, Thunderbird has no stored passwords for Google/Gmail, I have no overly protective antivirus software installed (only Windows Defender), I tried it with/without my VPN off.

I saw older articles mention allowing unsecure apps, yet this has been deprecated by Google in 2022 (I also tried "Password only" instead of "OAuth2", didn't work). I also never got an email from Google that a sign-in request was blocked (only the typical "Did you just sign in?").

Other (non-Google) accounts work fine in Thunderbird, and I only installed it today (so there should be no updates), while another Gmail account of mine doesn't work, either.

I am out of ideas what I could try to get my accounts to work... Can anyone help me?

I am trying to migrate from Mailspring to Thunderbird, yet have problems with adding my Google/Gmail accounts. When I try to add a new account with my email and password, Thunderbird detects the IMAP details as follows: INCOMING SERVER Protocol: IMAP Hostname: imap.gmail.com Port: 993 Connection security: SSL/TLS Authentication method: OAuth2 Username: <my email> OUTGOING SERVER Hostname: smtp.gmail.com Port: 465 Connection security: SSL/TLS Authentication method: OAuth2 Username: <my email> When I then try to connect, I get the Google sign in popup, where I re-enter my password and grant the access via 2FA. Then, the screen to give Thunderbird read/write permissions for mail, calendar, etc. appears, I click "Allow", the popup closes and Thunderbird tells me: "Unable to log in at server. Probably wrong configuration, username or password." I have checked other help articles; cookies are allowed, Thunderbird has no stored passwords for Google/Gmail, I have no overly protective antivirus software installed (only Windows Defender), I tried it with/without my VPN off. I saw older articles mention allowing unsecure apps, yet this has been deprecated by Google in 2022 (I also tried "Password only" instead of "OAuth2", didn't work). I also never got an email from Google that a sign-in request was blocked (only the typical "Did you just sign in?"). Other (non-Google) accounts work fine in Thunderbird, and I only installed it today (so there should be no updates), while another Gmail account of mine doesn't work, either. I am out of ideas what I could try to get my accounts to work... Can anyone help me?

All Replies (9)

more options
Are you certain you have allowed cookies in Thunderbird?

Also see https://support.mozilla.org/en-US/kb/automatic-conversion-google-mail-accounts-oauth20

more options

Yes, I am certain - the settings look like attached. I even added an exception for accounts.google.com on "Allow". Javascript is enabled as well.

more options
I even added an exception for accounts.google.com on "Allow".

That's what I did as well. With the exception in place you don't have to check the "Accept cookies from sites" option, and you neither need to accept third-party cookies.

What is your anti-virus software?

more options

I have no antivirus installed, except for Windows Defender.

more options

Try to start Windows 10 in safe mode with networking enabled.

Does the problem go away?

Windows safe mode disables anti-virus software. This is a troubleshooting step, not a solution.

more options

Sorry for getting back so late - unfortunately, that doesn't solve the problem either. 🙁 I get the same error message when trying to log into my gmail account.

more options

Does Thunderbird have an oauth password/Token in the password manager for imap.gmail.com? Does you google account show that Thunderbird has access to it?

If the answers there are no and then Yes, it would probably be you have software installed that is listening on the localhost adapter. Developer tools and web servers are the usual thing, but increasingly this proton mail bridge is a problem waiting to happen.

more options

Hey Matt, unfortunately, you are right - any ides how I could fix that issue? I ran `netstat -a -o` and looked at what services use 127.0.0.1. They are the following: - TeamViewer (established, listening) - Mouse Manager (listening) - Thunderbird (established) - MSS Connectivity Service (Samsung) (listening) - svchost

Now I do not know enough about ports on Windows to tell which of these might be problematic, or if there's a difference between listening and established regarding whether it could be an issue. I tried quitting Mouse Manager, TeamViewer and MSS CS via the task manager (i.e. the ports should be free again, if I understand correctly?). However, Thunderbird still doesn't connect my gmail accounts. :(

Any other ideas what to do?

more options

This is an incoming connection, I think, so it is possible you have a firewall, perhaps in a router of cable modem or the like that is blocking the incoming connection.

I would expect the port to be one of the standard web traffic ports. Probably port 443 or 80