'React jwt email verification
If I use firebase authentication and log in then I need to check that the email and password is similar of my previous user or not. const nodemailer = require('nodemailer'); const jwt = require('jsonwebtoken');
service: 'gmail',
auth: {
user: secure_configuration.EMAIL_USERNAME,
pass: secure_configuration.PASSWORD
}
});
const token = jwt.sign({
data: 'Token Data' .
}, 'ourSecretKey', { expiresIn: '10m' }
);
const mailConfigurations = {
// It should be a string of sender/server email
from: '[email protected]',
to: '[email protected]',
// Subject of Email
subject: 'Email Verification',
// This would be the text of email body
text: `Hi! There, You have recently visited
our website and entered your email.
Please follow the given link to verify your email
http://localhost:3000/verify/${token}
Thanks`
};
transporter.sendMail(mailConfigurations, function(error, info){
if (error) throw Error(error);
console.log('Email Sent Successfully');
console.log(info);
});````
i try this code but it's not working
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|