Node.js

Networking to Backend

The following Kotlin functions define how the mobile client communicates with the backend server to perform a phone number verification using the Verify API. This process consists of three main steps:

  1. Starting the verification process by submitting the phone number.
  2. Checking for a silent authentication result, which happens automatically in the background.
  3. Submitting the verification code (received silently or via fallback, like SMS) to complete the verification.

Each function runs inside a coroutine and performs network operations on the IO dispatcher to avoid blocking the main thread.

Start Verification

This function initiates the verification process by sending the user's phone number to the backend. The backend then starts the verification via the Vonage Verify API and responds with two values:

  • request_id: A unique identifier for the verification request.
  • check_url: A URL that can be used to check the result of the silent authentication.

Check Silent Authentication

After initiating the verification, this function initializes the silent authentication by sending a GET request to the check_url received earlier. If the silent authentication succeeds, the server responds with a verification code (after some redirects), which can be used to complete the verification process.

Submit Code

This function submits the verification code to the backend to finalize the verification process. The backend verifies the code using the Verify API and responds with a boolean indicating whether the verification was successful.

With these functions in place, your Android app can connect to your backend to complete the phone number verification process using Vonage Verify. The next step would typically involve handling success or failure in your UI, showing appropriate messages or redirecting the user accordingly.

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

以下の言語で利用可能:
Node.js
手順
1
Introduction
2
Before you start
3
Initialize the Project
4
Create a Simple Express Server
5
Setting up Vonage credentials
6
Add the Vonage Verify API
7
Testing the Backend
8
Create New Android Project
9
Set up app Android dependencies
10
Set up import and constants
11
Create Mobile UI
12
Networking to Backend
13
Testing Full Flow