SDK integration overview

更新时间:
复制 MD 格式

Integrate the Phone Number Verification Service into your business system. This enables scenarios such as one-click logon and helps reduce your operational and management costs. The integration of the Phone Number Verification Service includes client-side and server-side integration. This topic describes the basic information and key considerations for client-side and server-side Software Development Kits (SDKs).

Basic integration flow

  1. Preparations: Register an Alibaba Cloud account, complete identity verification, and activate the Phone Number Verification Service.

  2. Console: Create an authentication scheme in the Phone Number Verification Service console.

  3. Client: Integrate the client-side SDK for user interaction and server-side API communication.

  4. Server: Integrate the Alibaba Cloud SDK to call the OpenAPI of the Phone Number Verification Service. Authenticate users and retrieve phone numbers using client data.

Select an authentication method based on your requirements:

Authentication method

Integration method

Client-side SDK

Integration guide

Converged authentication

Server-side + Client-side

Converged authentication SDK

Converged authentication integration

Number verification

One-click logon

Server-side + Client-side

Number verification SDK

(Call different APIs to implement one-click logon or local number verification)

Number verification integration

Local number verification

Text message authentication (based on atomic capabilities)

Server-side only

-

Text message authentication API

Captcha authentication (based on atomic capabilities)

Server-side + Client-side

Captcha authentication SDK

Captcha authentication integration

What is the difference between one-click logon and local number verification?

  • One-click logon: The user grants authorization without entering a mobile phone number. The system retrieves the mobile phone number from the carrier gateway for the current connection. Includes a built-in authorization page.

  • Local number verification: The user enters their full mobile phone number. The system checks whether it matches the number for the current connection and returns "Consistent" or "Inconsistent". No built-in authorization page — you must implement your own.

Both features use the same client-side SDK (Number verification SDK) but call different APIs. Call only the APIs for your required features.

Client-side integration

The Phone Number Verification Service provides SDKs for different features (number verification, converged authentication) and clients (Android, iOS). Select the SDK that matches your requirements.

Download the SDK from the SDK Download page. Select your product and platform. Each SDK package includes a demo.

Server-side integration

The Phone Number Verification Service provides server-side APIs through OpenAPI for features such as one-click logon, local number verification, and SMS authentication. Integrate the Alibaba Cloud SDK to call these server-side APIs.

Integration method

The Alibaba Cloud SDK is the easiest way to call OpenAPI and provides the best support.

  • Alibaba Cloud SDK: Supported languages and dependency installation methods for the Phone Number Verification Service SDK are listed in the Server-side SDK reference.

  • Custom API call encapsulation (not recommended): Requires implementing the signature algorithm, building custom requests, and initiating HTTP calls manually. Request body and signature mechanism for V3.

Online debugging

https://api.alibabacloud.com/api/Dypnsapi/2017-05-25/

Version number

2017-05-25

2017-05-25 is the API version number, not a date. The APIs shown are the latest versions and have been updated since 2017-05-25.

Endpoint

dypnsapi.aliyuncs.com

Post-deployment verification

After you complete SDK integration, verify the deployment by performing the following steps:

  1. Obtain the scheme credentials: In the Phone Number Verification Service console, create a test authentication scheme to obtain the AppKey and AppSecret.

  2. Obtain a token on the client: Call the getLoginToken operation of the client-side SDK to obtain a logon token. The token is valid for 2 minutes for China Mobile, 60 minutes for China Unicom, and 10 minutes for China Telecom, and each token can be used only once. For more information about the token validity period, see SDK FAQ.

  3. Verify number retrieval on the server: Call the GetMobile operation on the server and pass in the token to verify whether number retrieval succeeds. If the call succeeds, the operation returns GetMobileResultDTO.Mobile, which is the phone number in plaintext (11 digits).

  4. Troubleshoot common errors:

    • Token expired: Complete the GetMobile call within the token validity period.

    • Token invalid: Check the AppKey and AppSecret configuration of the scheme.

    • Number retrieval failed: Check the network connectivity and the SDK version.

Notes

Server-side error codes

Next steps