const {
EMAIL_FROM,
EMAILS_TO,
USER,
GMAIL_CLIENT_ID,
GMAIL_PRIVATE_KEY
} = process.env;
let transporter = nodemailer.createTransport({
host: 'smtp.gmail.com',
port: 465,
secure: true,
auth: {
type: 'OAuth2',
user: USER,
serviceClient: GMAIL_CLIENT_ID,
privateKey: GMAIL_PRIVATE_KEY,
}
});
This code send emails just fine in local environment.
I deployed to heroku and I am getting an error: Error: Can't generate token. Check your auth options
The heroku config vars are coming through correctly, best I can tell.
Could there be some sort of IP restriction Google has against heroku servers? Am I missing something here?
This is a gSuite account with a Google service account.
Thanks