Getting "please log in via your web browser and then try again." message when trying to send gmail from my kubernetes application

9/25/2019

I have a node.js application that sends out gmail notifications for certain events. We recently switched from being directly hosted on DO to a Kubernetes cluster. After we switched, we started getting invalid login exceptions in the Node.js app and critical security alerts from Google. After researching the issue, we turned the "Less secure app access" setting on. Now, we are getting the error message that says "Please log in via your web browser and then try again."

I'm not sure where to go from here since I can't log in with a web browser from my Kubernetes cluster.

My code looks like this.

const nodemailer = require('nodemailer');
const mailer = nodemailer.createTransport(config.email);
...
req.app.locals.mailer.sendMail({
    from: 'myaddress@gmail.com',
    to: emails,
    subject: subject + " " + serverName,
    text: message,
});

Note that the code was working before the move to kubernetes.

Thanks in advance for your help.

-- mikeb
gmail
kubernetes
node.js
security

1 Answer

9/25/2019

Answered in comments, user did need to log into Google to acknowledge a blocker message.

-- coderanger
Source: StackOverflow