Email verification is a vital part of user authentication as it ensures inputed user email is correct and it validates without a doubt the credibility of the provided authentication credentials. Implementing this feature can be a drag so I am going to try to show you how I do it.
- First set up your nextJs project
create a lib folder and inside the folder create an actions.js file that will contain the registration logic
install these dependencies: using npm I nodemailer jsonwebtoken bcryptjs ejs
connect your database
create a sendMail function in a separate file
create a mail template
implement your action.js like thus
then use the logic in a registration form
you should be able to send the user a link to verify their mail when this is done
Top comments (0)