Why do I get a "Web Login Required" message when I connect to Gmail via IMAP?

I am trying to connect and get a list of message headers from Gmail via IMAP.

I get a response from Google with β€œWeb Login Required” and then a URL to continue logging in via the web interface. Magazine: http://hastebin.com/odufaducew.vhdl

Why is this happening? How to handle this business? I am using MailCore2 lib for iOS, if that helps at all.

+5
source share
2 answers

You can enable access for less secure applications on this Google page - Less secure applications

Select "Allow" and try again!

+6
source

As Legoscia notes, this happens when a login is performed using a password and is considered risky. The best option is to avoid storing and using user passwords for Gmail and instead switch to Oauth2. Is this application a mail user interface or are you using IMAP as an API? (Maybe https://developers.google.com/gmail/api/ would be more appropriate?)

0
source

Source: https://habr.com/ru/post/1201424/


All Articles