Overflowing

Usually I am overflowing with words. “Overflowing” is published by H.C. Rosario.

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




How I make OTP Service that works like Facebook Account Kit

If you ever used OTP gateway of Facebook Account Kit, you already know that Facebook shut down this service. It is sad news for all developers. Because we were getting this flawless service for free. In September 2019 Facebook announced this,

During that time, our client of Esho Sikhi wants us to develop the same OTP mechanism. I was thinking about how can I design such a system!! Then I realized before starting to make this, I should know how the OTP system of the Facebook Account Kit works. In this post, I will show you how I have developed the OTP gateway for my project (Esho Shikhi) which works as same as Facebook’s OTP kit.

What I used —

OTP Request from Mobile Application

At first, from the Application user enters his phone number and submits. The request is sent to the backend server. The server generates a 4 digit OTP and sends a request to SMS Gateway to deliver the OTP to the user. Next, the user gets OTP on his mobile. Meanwhile, the server stores 4 digit OTP, phone number, time limit of OTP, and the status of OTP (used or not used). Based on the phone number and time (in milliseconds), a unique hashed code is generated and stored in the Database.

OTP Validation in Backend

To validate the OTP, the user enters the OTP in the second form and submits it. The server validates the OTP based on the information stored in the Database (for validating OTP — 4 digit OTP must be matched, must be unused, must be less than or equal to the time OTP expires). If the OTP is valid, the hashed code is sent to the mobile application.

Final Login after OTP Validation

In the last part, the user logins by providing his phone number and the code which was given in the last step. After a successful login, the user gets the JWT token in response.

Later, the user uses the JWT token to call the authenticated API of the backend server.

So, this is how I integrated the OTP service in my project. If you face a similar problem, you may get help from this post. This process is currently working flawlessly. For any kind of questions regarding this service, through a response below.

Don’t forget to press claps👏🏼. If you like this article, make sure to follow my Medium profile and check out some other articles of mine! Follow Brain Station 23 Profile.

Add a comment

Related posts:

Leading Industrial Units Through the Lock Down!

These are unprecedented times. All bets are off the table, as they were all created in the old world. The new world leaves us fighting to catch our breath. As Karachi locks down, and other cities…

Creative Parenting with Harry Potter

Despite the monstrosity that the author has revealed herself as being, Harry Potter is an important factor in parenting my four kids. More than likely, we would not use these parenting approaches if…

How to Start and Succeed in Affiliate Marketing

Affiliate marketing is a system of marketing where by a company pays out a commission to a third party (affiliate) for bringing leads or generating traffic to the company’s products or services. In…