'Creating a email service in node.js

I am trying to create email scheduling service for the user in a MERN stack application. I am using nodemailer for the emailing service. But I requires enabling "access to less secured apps" in google account settings. The users will not feel safe with that option.

const transporter = nodemailer.createTransport({
    service: 'gmail',
    auth: {
        user: userEmail,
        pass: userPassword
    }
});

This is the code. It requires client id, secret and access token for nodemailer to send mail without "allow to less secure apps enabled". But I don't think I can get that info. Is there any other way to solve this or any alternative?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source