Node.js
Initialize the Project
In this first part of the tutorial, we will build a backend that uses the Vonage Verify API for 2FA. The backend will support both Silent Authentication and SMS-based verification.
Open your terminal and create a new project folder:
mkdir -p vonage-verify-tutorial/backend
cd vonage-verify-tutorial/backend
npm init -y
The npm init -y command will generate a package.json file with default settings. This file will manage our project's dependencies and scripts.
Now, let's install the required dependencies:
npm install express dotenv cors @vonage/verify2 @vonage/auth --save
express: A lightweight web framework for building APIs.cors: Middleware to allow cross-origin requests (important when connecting with mobile apps).dotenv: To load environment variables from a .env file.@vonage/auth: Manages authentication with Vonage APIs.@vonage/verify2: The Vonage Verify API client to handle 2FA.
After setting up, your folder structure should look like this:
backend/
├── server.js # Main server file
├── .env # Environment variables
└── package.json # Project configuration
Getting Started with Silent Authentication
Silent Authentication takes quite a bit to understand. This tutorial shows you how to build an integration from scratch with Nodejs and Kotlin
Available on:
Steps
1
Introduction2
Before you start3
Initialize the Project4
Create a Simple Express Server5
Setting up Vonage credentials6
Add the Vonage Verify API7
Testing the Backend8
Create New Android Project9
Set up app Android dependencies10
Set up import and constants11
Create Mobile UI12
Networking to Backend13
Testing Full Flow