My HNG Intership Journey And How I Implemented Account Verification In NodeJS

Hello friends in this article i will be documenting about my HNG journey and how i was able to implement a troubling feature for me while i worked on a backend project using NodeJs, Express and MongoDB. I would begin with how i was able to work around the challenge.

For this feature as i begun the project i had no idea how to implement it even though i knew at a basic level how account verification worked but actually writing code to recreate proved very challenging so i decide to do some extensive research

I started by reading articles from seasoned developers who shared their experience and how they built such a feature, i was able to come across multiple approaches however i decided to settle on a simple and effective method after carefully reading on the implementation process i decide to start writing code in my own way

With this method a link with an authentication token is sent to the email used to sign up and when the user receives the mail and tap the link the user's account is activated. So first off i created the project directory and set up the necessary environment to start spin the server.Then i set up the configuration to send the mail you can check how i did that in my most recent article Mailing with nodemailer.

On user sign up a unique 16 character token is generated and send to the user's email with nodemailer as a url after sending the email the token is saved in the database along with the user's information and user's account status is set to inactive. Once the user receives the mail and clicks the link an endpoint on the server retrieves the token from the url and searches through the database for an account with the same token once an account is found the tokens are compared and the user's status is updated to active after which the token on the database is set to null.

Writing about it now seems so easy but it was a real hassle implementing it i'm glad i was able to learn alot while i implemented the feature.

Now about HNG internship ( i would like to give it a try and test my programming skills to the extreme i know there is a lot i will be able to learn by just partaking in the programme and looking at the perks that come when you subscribe to the premium( and end up completing the programme i can't wait. Looking at the connections and network to be made i'm very excited for the coming weeks in HNG and can't wait to get started.