Captcha Service distinguishes between human users and automated bots. It helps businesses defend against bot-driven traffic in scenarios such as user registration, flash sales, and data queries. It uses interactive graphical challenges to block malicious requests and separate human from machine traffic. Alibaba Cloud PhoneNumberVerificationService provides four types of interactive challenges through the Captcha Service: click on icon, click on text, click in order, and nine-square grid verification. To use the Captcha Service, follow the instructions in this topic.
Prerequisites
Android
|
Item |
Requirement |
|
Development target |
Android 5.0 or later. |
|
Development environment |
Android Studio 4.1. |
|
Build tool |
Gradle. For Ant builds, decompress the package to extract the JAR file and resources. |
|
System dependencies |
None. |
|
Third-party SDK dependencies |
None. |
iOS
|
Item |
Requirement |
|
Development target |
iOS 9.0 or later. |
|
Development environment |
Xcode 13.0 or later. |
|
System dependencies |
Webkit.framework. |
|
Third-party SDK dependencies |
None. |
H5
|
Item |
Requirement |
|
Compatibility |
Internet Explorer 9 or later, Chrome, Firefox, Safari, Opera, mainstream mobile browsers, and embedded WebView on iOS and Android. |
Add a captcha scheme
-
In the left-side navigation pane, choose Converged Authentication (based on atomic capabilities) > Captcha Service > Captcha Scheme Management.
-
Click Add Captcha Scheme.
-
Configure the scheme parameters on the page.
-
Scheme name: Enter a name for the new captcha scheme.
-
Client type: Select Android, iOS, or H5.
-
-
Click OK.
-
On the captcha scheme list page, click Key Parameters in the Actions column to obtain the
appId,appKey, and other information.
Download and decompress the SDK
-
Log on to the Phone Number Verification Service console.
-
In the left-side navigation pane, choose Converged Authentication > Captcha Service > Learn about Captcha Service.
-
In the "Captcha Service integration steps" section on the page, click Download Now to go to the API&SDK page.
-
Download and decompress the appropriate SDK or JS file for your client. No download is required for the server side. On the API&SDK page, set Select Product Integration to Captcha, Select Client to APP or Web, and Select Platform to Android or iOS. Then, from Select Version, choose the required version (for example, Standard Edition 1.8.3) and click SDK Download (with demo).
Deployment and integration
Server-side
For server-side integration instructions, see Server-side integration.
Client-side
-
For Android integration instructions, see Android client-side integration.
-
For iOS integration instructions, see iOS client-side integration.
-
For Web or H5 integration instructions, see H5 client-side integration.
-
You can send server-side requests using any method, provided the request parameters are complete and correctly formatted. We recommend using the
application/x-www-form-urlencodedformat. -
To fully protect your business, deploy both client-side and server-side components. Deploying only the client-side component leaves your API vulnerable to attacks.
Product configuration and data viewing
Configure verification types
Captcha Service provides four verification types, listed in increasing order of security: click in order, click on text, nine-square grid verification, and click on icon. You can configure one or more interaction types on the Captcha Scheme Management page.
Captcha Service also provides anti-fraud protection and selection guidance:
-
Captcha Service automatically monitors and blocks abnormal traffic. If a single IP address performs more than 100 verification attempts within one hour or exhibits other bulk-request behavior, the requests are blocked even if the answers are correct.
-
For security-sensitive scenarios, we recommend choosing click on icon or nine-square grid verification. These two types rely more heavily on semantic recognition and provide stronger dynamic defense, which effectively blocks brute-force scripts and automated answer recognition by models. Experience-oriented types such as slider verification provide comparatively weaker protection.
-
Captcha Service continuously updates the size and categories of its image library to further strengthen its anti-fraud capabilities.
View verification traffic data
-
On the Captcha Scheme Management page, click Authentication Traffic Chart in the Actions column.
-
On the Authentication Traffic Chart page, you can view data for the selected scenario, including the number of client-side verification attempts, successes and failures, and the volume of server-side secondary verification.
Captcha Service is billed based on the number of verification attempts. For detailed billing rules, see product pricing.
FAQ
How do I prevent bot traffic (anti-fraud) in one-click login or one-click registration scenarios?
Anti-fraud protection for one-click login and one-click registration cannot be enabled through console settings alone. You must integrate your code with Captcha Service to enable this protection. For the integration procedure, see Captcha service.
After I change the verification type in the console, do I need to modify my client-side code?
No. You do not need to modify your client-side code. Go to the Captcha Scheme Management page in the console, select the new verification type, and confirm the change. The new verification type takes effect immediately.
What happens if I select multiple verification types?
If you select multiple verification types, Captcha Service randomly presents one of the selected types to users during verification.
Does Captcha service support use outside mainland China, and does it provide global acceleration?
Yes. The captcha feature of Phone Number Verification Service supports use outside mainland China. Overseas cluster acceleration configurations have been added to ensure a smooth access experience for overseas users.
What do the ip_type and client_type parameters in the captcha verification response mean, and what values can they have?
-
ip_type: The IP type resolved for the client that performed the verification. This is an auxiliary analysis field and does not affect the verification process. We do not recommend using it to restrict business logic. Valid values:Value
Description
0
Unrecognized type
1
Data center
2
Dedicated egress
3
Standard broadband
4
Mobile broadband
5
Media provider IP
6
Crawler
7
Small and medium-sized carrier
-
client_type: The client type from which the verification request originated. Valid values:web,Android,iOS, andHarmony.