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
Preparations: Register an Alibaba Cloud account, complete identity verification, and activate the Phone Number Verification Service.
Console: Create an authentication scheme in the Phone Number Verification Service console.
Client: Integrate the client-side SDK for user interaction and server-side API communication.
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 | ||
Number verification | One-click logon | Server-side + Client-side | Number verification SDK (Call different APIs to implement one-click logon or local number verification) | |
Local number verification | ||||
Text message authentication (based on atomic capabilities) | Server-side only | - | ||
Captcha authentication (based on atomic capabilities) | Server-side + Client-side | Captcha authentication SDK | ||
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.
|
Online debugging | |
Version number |
|
Endpoint | dypnsapi.aliyuncs.com |
Post-deployment verification
After you complete SDK integration, verify the deployment by performing the following steps:
Obtain the scheme credentials: In the Phone Number Verification Service console, create a test authentication scheme to obtain the
AppKeyandAppSecret.Obtain a token on the client: Call the
getLoginTokenoperation 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.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).Troubleshoot common errors:
Token expired: Complete the
GetMobilecall within the token validity period.Token invalid: Check the
AppKeyandAppSecretconfiguration of the scheme.Number retrieval failed: Check the network connectivity and the SDK version.
Notes
Server-side error codes
Use the returned error code to verify your request parameters. Look up codes in the Error Code Center.
You can also record the RequestID from the API response or the error message from the SDK, then use the Alibaba Cloud OpenAPI Diagnostic Platform to troubleshoot.
Next steps
To learn more about server-side and client-side interaction flows for each authentication feature, see Interaction flows.