How to integrate the new Login with OTP widget

MSG91 has introduced a new widget for OTP Login that clients can integrate on their end and all the Send, Resend, and Verify OTP APIs can be called by MSG91 at one place.


To integrate it, follow the below steps-


1. Log in to your MSG91 panel and select the OTP section.



2. Select the Send OTP option from the sidebar and click on the Create New Widget option on the right.



 

3. Select the Custom tab. Give your widget a name. Select the channel (SMS, Email, or both) via which you wish to send the OTP in the Send OTP To option. Select the SMS template from the flows list of your account and the Email template from the Email templates list of your account.

To create a new SMS flow, refer to this guide.

To create a new email template, refer to this guide.


Select the length of your OTP in the OTP Length option. Please note that the retry process for OTP sent via mail will be via mail only and retry for OTP sent via SMS can be via voice or SMS. Once done, click on the Update button.



4. The widget script will be shown on the right screen. 

In the success and failure parameter in the script, enter the location where you want to print the verified token of the user. You will provide this token to MSG91 via the API given in the Server-Side Integration section as shown in the below image. It will require the authkey of the account. To get it, click on the Click here link in the Note under the Server-Side Integration.



Enter the Auth Token in the script and use this script where you want to integrate the service. To get it, click on the Click here link in the Note under the Client-Side Integration or go to the Token section from the sidebar. Copy the token from there. 

If no token is generated, you can generate a new one from the Generate New Token button from the top right.



5. Now you click on the Preview Demo button from the bottom of the script. Enter the token first in the popup and click on Submit button. It will show the Login with OTP popup as would be shown to the user where the number or email would be required to receive the OTP with a Generate OTP button.



6. If the user enters the correct OTP and is verified, the verified token of the user will be printed on the location you have specified in the script and you shall provide that to MSG91 with the above API. Once received on our side, we will mark the user as verified.


Note-


If you use the Default tab-



1. The OTP would go with the default content-


Hi, Your OTP Verification Code is (OTP)

Do not share it with anyone.

--Dash


The sender ID for India would be DSHOTP


2. The retry mode in SMS would be voice only.


3. You won't be able to see the logs or delivery report for the same.