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:

  1. Enter a valid phone number (including country code)
  2. 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 ngrok or a similar tool.
  • Missing Permissions: Check that the Android app has Internet permissions enabled in AndroidManifest.xml.