DEV Community

Cover image for How to fix Gmail login in your application?
Richard Dobroň
Richard Dobroň

Posted on

How to fix Gmail login in your application?

Google has announced that some accounts will no longer be able to use Less Secure Apps feature, starting May 30th, 2022.

Your application will contain an error similar to this:

Uncaught Exception: Cannot connect to Gmail: Can not authenticate to IMAP server: [AUTHENTICATIONFAILED] Invalid credentials (Failure) in /home/secret/public_html/mailer/smtp.php:208

What are Less Secure Apps in Gmail?

With Less Secure Apps feature, you can use your main Google username and password to sign in to your Gmail account on software and devices.

Fix using an App Password

To use an app password, you must first turn on two-factor authentication for your Google account.

security-2fac.png

After that, in your Google account's security settings, you can set an app-specific password for SMTP.

app-passwords.png

Then type the name of the application that will help you identify this password.

app-passwords2.png

Your password will be generated after clicking the Generate button.

app-passwords3.png

And that's it, now just use this new password to log in.

Top comments (0)