Gmail POP3 authentication failed — switch to application password

AI-generated summary

Users davidkingham and omarfilip reported Gmail POP3 authentication failures after recent updates, despite successful browser logins and enabled “Less secure app access.” The error message indicated Google requires web login, pointing to a Google-side change rather than a Discourse issue. itsbhanusharma suggested using an Application Password instead of the regular password, which resolved the issue for both omarfilip and davidkingham. davidkingham noted that when generating the application password, selecting “Other” under the app dropdown (not “Mail”) is important. itsbhanusharma also recommended considering the mail-receiver container for incoming emails as a more secure alternative, since Google is tightening security around POP3 access.

After updating, my POP3 will not authenticate, nothing has changed except updating to latest. I logged in to gmail in a browser with the same credentials no problem. Here is the error in the logs:

/usr/local/lib/ruby/2.5.0/net/pop.rb:1006:in `check_response_auth'
/usr/local/lib/ruby/2.5.0/net/pop.rb:905:in `auth'
/usr/local/lib/ruby/2.5.0/net/pop.rb:567:in `do_start'
/usr/local/lib/ruby/2.5.0/net/pop.rb:531:in `start'
/var/www/discourse/app/jobs/scheduled/poll_mailbox.rb:41:in `poll_pop3'
/var/www/discourse/app/jobs/scheduled/poll_mailbox.rb:16:in `execute'
/var/www/discourse/app/jobs/base.rb:137:in `block (2 levels) in perform'
/var/www/discourse/vendor/bundle/ruby/2.5.0/gems/rails_multisite-2.0.6/lib/rails_multisite/connection_management.rb:63:in `with_connection'
/var/www/discourse/app/jobs/base.rb:127:in `block in perform'
/var/www/discourse/app/jobs/base.rb:123:in `each'
/var/www/discourse/app/jobs/base.rb:123:in `perform'
/var/www/discourse/app/jobs/base.rb:185:in `perform'
/var/www/discourse/vendor/bundle/ruby/2.5.0/gems/mini_scheduler-0.9.1/lib/mini_scheduler/manager.rb:82:in `process_queue'
/var/www/discourse/vendor/bundle/ruby/2.5.0/gems/mini_scheduler-0.9.1/lib/mini_scheduler/manager.rb:30:in `block in initialize'

Edit: I tried testing POP3 via Test your SSL POP3 Mail Server • Wormly Monitoring and got this error:

S:-ERR [AUTH] Web login required: https://support.google.com/mail/answer/78754
ERROR: Login failed -ERR [AUTH] Web login required: https://support.google.com/mail/answer/78754
POP3 test failed.

But, I have logged in a browser. So I guess it’s not a discourse issue, but I would appreciate any ideas. I tried turning on less secure apps

Same issue. It started this morning on my one week-old Discourse version, so it’s not a change in Discourse, but something that Google did.

Like @davidkingham I have " Less secure app access" enabled and I can log in to Gmail via browser with existing credentials.

Maybe try using Application Password instead of regular password?

That worked, @itsbhanusharma - thanks.

In case this is something others encounter, to switch to an application password see:

Gmail is trying to be more secure.
Unless you have specific reasons to poll gmail, maybe consider running the mail-reciever container to handle incoming emails.

This worked for me as well, FYI for others when creating the key; under the app dropdown, select ‘other’, not mail. Thank you @itsbhanusharma