Node.js
Testing the Full Flow
In this part, we’ll test the complete 2FA flow.
Run the Backend
Before running the backend, double-check your .env file for correct API credentials.
Navigate to the project directory and start the server:
cd backend
node server.js
You should see:
Server is listening on port 4000
Use curl to quickly check if the server responds:
curl -X POST http://localhost:4000/verification -d '{"phone":"+34600000000"}' -H "Content-Type: application/json"
Run the Android App
Make sure the backend URL in the Android client is correctly set to:
const val BACKEND_URL = "http://ip-of-your-backend:4000"
If your backend in running in localhost, you might want to use ngrok or similar to expose your local backend externally.
Start the verification:
- Enter a valid phone number (including country code)
- Press "login"
The app will attempt Silent Authentication automatically:
- If successful, you'll see:
✅ Verified via Silent Auth
- If it fails, the message will be:
Silent Auth failed, please enter SMS code
The app will then switch to the SMS verification mode.
Troubleshooting Tips
- Network Issues: Since our mobile app requires internet permissions, using a real device often makes things easier. However, the emulator should work fine as long as your backend is exposing the port externally using
ngrokor a similar tool. - Missing Permissions: Check that the Android app has Internet permissions enabled in
AndroidManifest.xml.
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