1. How can I debug what exactly is being sent and where?

  2. The account I'm trying to connect has "two-step" authorization enabled. However, I've checked that IMAP access is enabled and that "less secure" applications are allowed to access my account.

I thought, that if two-step authentication was a problem, I should be seeing a different error message, however, what I see is:

nnimap (gmail) open error: 'NO (AUTHENTICATIONFAILED) Invalid credentials (Failure)'.

I'm absolutely sure that the details I provided in ~/.authinfo.gpg are correct.

My nnimap settings:

(setq gnus-select-method
      '(nnimap "gmail"
               (nnimap-address "imap.gmail.com")
               (nnimap-server-port 993)
               (nnimap-stream ssl)
               (nnir-search-engine imap)))

I'm able to connect with same configuration to another GMail account (by changing the details in ~/.authinfo.gpg).

  • is this helping?: emacs.stackexchange.com/questions/17626/…
    – jue
    Jun 4, 2017 at 16:01
  • Have you tried setting auth-sources '("~/.authinfo.gpg")? Did you try with an ordinary .authinfo (without encryption)?
    – jue
    Jun 4, 2017 at 16:22
  • @jue the article hinted at the way one needs to set up double authentication with Google, which I tried, but either it doesn't work, or I don't understand how to use it, or my company's administrator had somehow prevented me from doing it. As for the other question: .authinfo.gpg works fine. If I change the information there so that instead of accessing company's provided account, I access my personal GMail account it works.
    – wvxvw
    Jun 5, 2017 at 6:26

1 Answer 1


You need generate a password for your application only (Gnus, in this case).

See https://support.google.com/mail/answer/185833?hl=en

I finished setup for Gnus in 1 minute, even though I never use 2 step verification for Gmail before.

  1. Enable 2 step verification, I did a quick search and went to https://myaccount.google.com/security. Just follow its step by step guide and submit the form

  2. In order to setup Gmail app password, I googled the keyword and went to https://support.google.com/accounts/answer/185833?hl=en. Click the link "How to generate an App password", read the guide and click the link inside it. Login in with your google account

  3. There is a "App" section inside dashboard, you can not miss it. Follow the guide.

I don't know what's your Gnus setup. To be honest, your question lacks the essential information. See https://github.com/redguardtoo/mastering-emacs-in-one-year-guide/blob/master/gnus-guide-en.org on how to setup Gnus.

  • Hey, thanks, I had a feeling this might be it... Sasha Chua also wrote she did this. But, the help article doesn't explain how to do this. Would you care to explain? When I try following the link in this "article" it says "The setting you are looking for is not available for your account."
    – wvxvw
    Jun 5, 2017 at 6:17
  • @wvxvw are you a Google Apps customer, or is this a regular Gmail account? In case of the former, you have to enable the feature in your domain control panel.
    – daveloyall
    Jun 5, 2017 at 16:14
  • OK, I figured out finally what was going on. My company that used GMail service required that all employees use two-step verification. But, somehow, I've never created a second password, so my GMail account was in the limbo: I didn't have second password, but it still believed that I must have one. I was able to log in because of some cookie-related confusion. Finally, the cookies expired and I had to create the second password. Once that was done, I could follow the procedure outlined in this reply.
    – wvxvw
    Jun 22, 2017 at 6:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.