tencent cloud

Tencent Cloud EdgeOne

Release Notes and Announcements
Release Notes
Security Announcement
Announcements
Product Introduction
Overview
Strengths
Use Cases
Comparison Between EdgeOne and CDN Products
Use Limits
Purchase Guide
Description of Trial Plan Experience Benefits
Free Plan Guide
Billing Overview
Billing Items
Subscriptions
Renewals
Instructions for overdue and refunds
Comparison of EdgeOne Plans
About "clean traffic" billing instructions
DDoS Protection Capacity Description
Getting Started
Choose business scenario
Quick access to website security acceleration
Quick deploying a website with Pages
Domain Service&Origin Configuration
Domain Service
HTTPS Certificate
Origin Configuration
Site Acceleration
Overview
Access Control
Smart Acceleration
Cache Configuration
File Optimization
Network Optimization
URL Rewrite
Modifying Header
Modify the response content
Rule Engine
Image&Video Processing
Speed limit for single connection download
DDoS & Web Protection
Overview
DDoS Protection
Web Protection
Bot Management
API Discovery(Beta)
Edge Functions
Overview
Getting Started
Operation Guide
Runtime APIs
Sample Functions
Best Practices
Pages
L4 Proxy
Overview
Creating an L4 Proxy Instance
Modifying an L4 Proxy Instance
Disabling or Deleting an L4 Proxy Instance
Batch Configuring Forwarding Rules
Obtaining Real Client IPs
Data Analysis&Log Service
Log Service
Data Analysis
Alarm Service
Site and Billing Management
Billing Management
Site Management
Version Management
General Policy
General Reference
Configuration Syntax
Request and Response Actions
Country/region and Corresponding Codes
Terraform
Overview
Installing and Configuring Terraform
Practical Tutorial
Automatic Warm-up/Cache Purge
Resource Abuse/hotlinking Protection Practical
HTTPS Related Practices
Acceleration Optimization
Scheduling Traffic
Data Analysis and Alerting
Log Platform Integration Practices
Configuring Origin Servers for Cloud Object Storage (Such As COS)
CORS Response Configuration
API Documentation
History
Introduction
API Category
Making API Requests
Site APIs
Acceleration Domain Management APIs
Site Acceleration Configuration APIs
Edge Function APIs
Alias Domain APIs
Security Configuration APIs
Layer 4 Application Proxy APIs
Content Management APIs
Data Analysis APIs
Log Service APIs
Billing APIs
Certificate APIs
Origin Protection APIs
Load Balancing APIs
Diagnostic Tool APIs
Custom Response Page APIs
API Security APIs
DNS Record APIs
Content Identifier APIs
Legacy APIs
Ownership APIs
Image and Video Processing APIs
Multi-Channel Security Gateway APIs
Version Management APIs
Data Types
Error Codes
FAQs
Product Features FAQs
DNS Record FAQs
Domain Configuration FAQs
Site Acceleration FAQs
Data and Log FAQs
Security Protection-related Queries
Origin Configuration FAQs
Troubleshooting
Reference for Abnormal Status Codes
Troubleshooting Guide for EdgeOne 4XX/5XX Status Codes
520/524 Status Code Troubleshooting Guide
521/522 Status Code Troubleshooting Guide
Tool Guide
Agreements
Service Level Agreement
Origin Protection Enablement Conditions of Use
TEO Policy
Privacy Policy
Data Processing And Security Agreement
Contact Us
Glossary

Mobile Integration Overview

PDF
Focus Mode
Font Size
Last updated: 2025-11-27 15:59:22

Overview

Client attestation ensures each API request carries a valid attestation token, thereby verifying the request originates from a trusted mobile app and effectively resists malicious requests. Unlike the automatic interception mechanism for web or WebView clients, mobile client integration requires developers to adapt at the application layer to achieve request sending, attestation token retrieval and attachment, and server challenge response.

Compatibility

EdgeOne Client Attestation SDK supports the following mobile terminals:
iOS 11 or higher operating system.
Android 5.0 (API level 21) or higher operating system.

Mobile SDK Operation Mechanism Overview

The EdgeOne Client Attestation SDK operates in iOS or Android environments, with its core mechanism built around collaboration between client applications, the SDK, attestation service, and EdgeOne. Developers proactively call the SDK API in application code to implement a complete attestation process.
Note:
Developers need to explicitly handle HTTP 428 responses in code, call the SDK for attestation challenge, then add the obtained token to subsequent requests. The SDK is responsible for attestation logic execution and token generation and management, but request sending, response capture, and retry logic must be implemented at the application layer.
Here is how it works:
1. API request initiation: The mobile application initiates an API request to the backend service protected by EdgeOne. The initial request may not include an attestation token or may contain an expired/invalid token.
2. EdgeOne attestation challenge: After receiving the request, EdgeOne performs validation based on the configured attestation policy. If the request does not meet attestation requirements (such as lack of token or invalid token), EdgeOne will return HTTP 428 status code and carry an attestation challenge ID in the response header EO-Attest-Challenge.
3. Client handles the challenge: After receiving the HTTP 428 response, the mobile application needs to extract the EO-Attest-Challenge ID from the response header. Subsequently, the app calls the SDK's attestWithParams() API and imports this challenge ID. The SDK will execute the appropriate attestation process based on the challenge type (such as Captcha or invisible verification). For detailed client attestation process, refer to the product description (see: Tencent Cloud Captcha, Tencent Cloud Risk Control Engine).
4. SDK interacts with the attestation service: After receiving the challenge ID, the SDK interacts with the EdgeOne attestation service to complete the client attestation process. This may involve displaying a verification code interface in WKWebView for user interaction or executing proof-of-work in the background.
5. Obtain attestation token: After attestation succeeded, the SDK will generate a valid attestation token. The app obtains this token via the interface provided by the SDK (such as getAttestationToken()).
6. Resend request: The app adds the newly obtained attestation token to the EO-Attest-Token HTTP header of the original API request and resends it.
7. EdgeOne proceeds with the request: After receiving the request with a valid attestation token, EdgeOne verifies the token's validity and allows the request to flow to the backend service.

Client authentication process using iOS SDK
Client authentication process using iOS SDK


Attestation Credential Token Workflow

The attestation token is a key credential that establishes trust between the client and EdgeOne attestation service. In iOS or Android applications, developers need to understand and correctly handle the attestation token lifecycle, including obtaining, using, and renewing.

Obtaining a New Attestation Credential Token (Or Manual Attestation)

In some scenarios, you may need to actively trigger client attestation to retrieve a new attestation token, for example:
Before the first request: After the application launches, you can actively call the SDK for attestation before sending the first request to the protected API to avoid receiving a 428 challenge on the first request.
Handling HTTP 428 Challenge: When receiving an HTTP 428 status code returned by the server, extract the challenge ID and call the SDK API to initiate the attestation challenge.
Mandatory attestation: When the business logic requires forcing user attestation.
You can initiate the attestation challenge by calling the SDK's attestWithParams() method. This method executes the attestation process based on the challenge parameters and returns the attestation token via AttestCallbackDelegate upon success.
Note:
After each successful call to attestWithParams(), the SDK generates or updates the attestation token. Before attaching the token to request headers, be sure to call getAttestationToken() again to get the latest token. Each time you need to use token data, please retrieve new token data. Do not save or reuse the token data returned by getAttestationToken().

Using Existing Attestation Token

Once the attestation token is successfully acquired, the SDK will cache it internally. Within the token's TTL, you can reuse this cached token without the need to re-execute the attestation challenge each time. Even if the app is suspended in the backend or wakes up from idle status, the SDK provides a valid cached token.
When sending a request to a protected API, you need to get the current valid attestation Token from the SDK and add it to the EO-Attest-Token header of the HTTP request. The SDK provides the getAttestationToken() method to obtain this Token.

Reobtaining an Attestation Token or Renewing an Expired Attestation Token (Handling HTTP 428 Challenge)

The attestation token has a valid period. When the token expires or becomes invalid for other reasons, the EdgeOne server will return an HTTP 428 status code to indicate the client needs to authenticate again. This is one of the most important adaptation steps in iOS and Android client integration.
Your application needs to implement a healthy mechanism to capture and address HTTP 428 responses. A typical workflow is as follows:
1. Capture 428 response: In your network request callback, check the HTTP response status code. If it is 428, it indicates an attestation challenge is needed.
2. Extract challenge ID: Extract the attestation challenge ID from the EO-Attest-Challenge response header in the HTTP 428 response. This is the credential to initiate a new attestation challenge.
3. Execute attestation challenge: Call the attestWithParams() method of the SDK and input the extracted challengeId. If the authenticator requires user interaction (such as Captcha), you also need to provide a WKWebView instance.
4. Obtain new token: After the attestation challenge succeeds, get the latest attestation token generated by the SDK via getAttestationToken().
5. Resend request: Add the new token to the EO-Attest-Token header of the original API request and resend it. At this point, the request should pass EdgeOne's attestation and flow normally to the backend service.

Using WKWebView or WebView for Interactive Attestation (And JS Attestation)

In some client attestation scenarios, the authenticator may require user interaction (e.g., interactive Captcha) or execute compute-intensive tasks (e.g., Proof of Work encryption). At this point, the EdgeOne SDK needs specific environment support. On mobile platforms, WKWebView (iOS platform) or WebView (Android platform) are key components to implement these features.
Note:
In the following content, WebView will be used to unify the reference to corresponding components on different platforms, namely: WKWebView (iOS platform) or WebView (Android platform). Use the actual platform component name for adaptation.
When the authenticator needs to render an interactive CAPTCHA or run a JavaScript-based Proof-of-Work encryption challenge, the SDK requires a WebView instance to be provided when calling the attestWithParams() method. This means developers must allocate a WebView instance in advance in the application and pass it as an argument to the SDK when calling the attestation API.

Interactive Attestation Scenario

Some authenticators (such as TC-CAPTCHA using embedded or pop-up interaction settings) require a WebView instance to render their interactive interface. This WebView instance will display the verification code webpage within the application, so it must be preset to ensure correct display.
Embedded Interactive Attestation: The CAPTCHA interface is displayed in a fixed block form on the device screen. To ensure the UI displays correctly without affecting user experience, developers must preset the rendering window's size, layering sequence, and alignment mode. Please note, the embedded attestation GUI does not scale with the screen view. For example, TC-CAPTCHA embedded mode recommends reserving at least 300x230 pixel space to get the best rendering effect and user interaction experience.
Pop-up Interactive Attestation: The CAPTCHA interface appears as a floating window on the device screen when attestation is triggered. Similar to embedded attestation, the rendering window's size, layering sequence, and alignment mode must also be preset. The pop-up attestation feature is that when the screen view is less than a specific threshold, the pop-up attestation GUI automatically scales to adapt to different screen sizes. For example, the initial rendering block size for TC-CAPTCHA pop-up mode is 360x360 pixels.

JavaScript-Based Attestation Scenario

Some authenticators (such as TC-CAPTCHA in seamless mode) require a WebView instance as the JavaScript runtime environment, primarily used to execute encrypted Proof of Work (PoW) challenges. In this scenario, the WebView instance provides only a JavaScript execution sandbox, with no need to visibly render any UI. Therefore, the passed-in WebView instance does not need to be visible, and the SDK will not use it for UI rendering.

Validating Integration

To ensure stable operation of the EdgeOne client attestation SDK in your application, refer to the following KPIs to determine whether integration is successful (recommend troubleshooting sequentially):



Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback