One-Time Password Service Using the Dispatch API

One-time passwords arevery quiet Familiar lately, mainly because of security requirement that conventional passwords don’t guarantee. While the security of the standard password is the responsibility of the consumer, who as we well understand frequently doesn’t care, the OTP is practically self-protected since it is generated randomly, and its validity is restricted in time.You can use OTPs rather than conventional Passwords, or to reinforce the conventional authentication procedure with two-factor authentication approach. In fact, you can use OTPs where you will need a mechanism which ensures a user’s identity by relying upon a communication medium possessed by himself: a mailbox, a telephone, a particular app, etc. In this Guide we will see how to execute A simple OTP service based on two Web APIs.

  • The first API lets you make the otp service and to send it to the consumer via Facebook Messenger as the main medium, or through SMS as a fallback medium
  • The next API enables the user to confirm the OTP he obtained
  • The OTP service does not have any user interface. It is Conceived as a microservice you can invoke from the program to generate and confirm OTPs.

To complete this tutorial, you will require a Vonage API accounts. If you Don’t have one, you can register today and begin building with free credit. As soon as you have an account, you can find your API Key and API Secret in the peak of the Vonage API Dashboard.As a first step, you need to clone or Download the job from the GitHub repository.Once you have the job’s code on your Computer, you want to install its dependencies by moving into the project’s folder and typing the following command. As we will see later, the program uses Express as its web framework as well as the Vonage customer library for Node.js, so as to send the OTP to the consumer.

Configure the Application

Before using the OTP service, you need to Perform some settings on the Vonage API dashboard to be able to permit the message delivery via the Vonage Dispatch API.This API allows you to send messages to your users by using multiple channels with prioritization. By way of instance, in our case, we will send the OTP to the consumer via their Messenger accounts, as a first effort. If the user does not read it within a given amount of time, the message will be sent via SMS for their contact number.