Overview
Integrate Tencent eSign electronic signing capabilities into third-party applications via OAuth authorization and WebView embedding. This guide targets integrator R&D teams, covering the full flow from credential preparation to embedded page integration.
Integration Scenarios
The integrator application embeds two functional entry points in the toolbar or promotional area:
- Initiate Signing — After the integrator application completes OAuth authorization, it calls Upload File to obtain a
FileId, then calls Get Embedded View URL to bind theFileIdto the embedded page URL, and finally opens the embedded page via WebView to complete the envelope creation flow (set recipients → place signature areas → send) - Signing Status — Exchange for an embedded page URL; the WebView directly displays the contract list of the current account under the selected Space
The embedded pages are provided by Tencent eSign and support integrator branding (see Embedded Views - Branding). They interact with the Tencent eSign server side via a webview token.
Access Modes
| Mode | Currently Supported | Description |
|---|---|---|
| WebView Embedding | Supported | The integrator provides entry points and files; the UI is rendered by the Tencent eSign embedded page |
| Pure API (Headless) | Planned | The integrator implements the sender UI on its own; not covered by this guide |
| Signing-only Embedding (Recipient UI) | Planned | Use the Tencent eSign embedded signing page only on the recipient side |
When the flows in this guide cannot meet your business requirements, please contact Tencent eSign business or technical liaisons to evaluate other access modes.
OAuth Authorization Modes
This guide supports two authorization modes for different integration scenarios:
- Open Mode (default) — Targets C-end users. Each email can initiate authorization independently. The Space is selected by the user on the Consent page or auto-created by the system. The authorization URL does not require
space_id - Designated Space Mode — Targets enterprise/organization scenarios. The authorization target is limited to a Space pre-designated by the integrator. Requires the Pre-add Members API to pre-add members. The authorization URL must include both
space_idandlogin_hint. See OAuth Authorization Flow - Designated Space Mode
Core Concepts
| Term | Description |
|---|---|
| Integrator | The third-party vendor accessing Tencent eSign; in this guide, it defaults to the integrator R&D team / engineering entity |
| Integrator application | The application provided by the integrator to end users (including its frontend and backend, without distinguishing process boundaries). This guide uniformly uses “integrator application” to refer to the party calling the Open API |
| Integration App / App Installation | The OAuth app registration entry on the Tencent eSign side; “installation” means a Space consents to access the OAuth app, which is different from “integrator application” — the former is a resource record on the Tencent eSign side, the latter is the integrator’s own program |
| Space | Tencent eSign multi-tenant space, with two semantics: (a) Integrator Space — created when the integrator registers a console account, used for publishing OAuth apps and binding billing resource packages; (b) User Space — used by end signing users to initiate/receive signing and install third-party apps. Data between the two is independent. Hereafter, unless specifically noted, “Space” refers to (b) User Space |
| Integrator Space | The Space created after the integrator registers a console account, used only for app publishing and billing; it does not participate in the “user selects Space” step of the OAuth authorization flow |
| Admin / Regular Member | Two roles within a (User) Space. Only admins can install third-party integration apps for the Space; regular members can use installed apps to initiate signing |
| OAuth Client | OAuth protocol term, refers to the party holding client_id / client_secret, which is the integrator application in this integration |
| client_id / client_secret | OAuth client credentials, generated when the integrator creates an OAuth app under the integrator Space in the console |
| PKCE | OAuth 2.1 man-in-the-middle prevention extension (code_verifier / code_challenge). The OAuth client generates a random code_verifier, takes its SHA-256 and base64url-encodes it to get code_challenge. code_challenge is sent during authorization, and code_verifier is sent when exchanging for a token to verify consistency |
| access_token | OAuth access token, used to call Tencent eSign Open API (e.g., exchange for webview URL). Valid for 1 hour |
| refresh_token | Used to exchange for a new access_token after the access_token expires. Permanent (no expiry); after refresh, the new value replaces the old one (rolling refresh, see OAuth Authorization Flow - Token Lifecycle) |
| webview token | A one-time session token for embedded pages, bound to user_id + space_id + app_id + page type + OperateParam, with a validity period defined by the server. Used only for interactions between the embedded page and the Tencent eSign server |
| WebView | The browser component embedded in the integrator application, used to load Tencent eSign Consent pages and embedded pages |
| Consent Page | The user authorization consent page, provided by Tencent eSign |
| Embedded page | The Tencent eSign business page (initiate signing / signing status) loaded by the integrator in a WebView |
For core signing flow concepts such as Envelope, Recipient, and Tab, see Envelope Signing - Overview.
Key Constraints
- The integrator accesses via the third-party app mode (third_party app)
- The integrator first self-registers an account in the Tencent eSign console (creating an integrator Space). The admin of that Space creates an OAuth app in the console, which directly generates
client_id/client_secret. In multi-region scenarios, the integrator must register separately in each region and create an app in each; credentials are isolated by region and not interchangeable (billing resource packages are also region-closed) - First-time user access (both modes):
- Open Mode — The integrator can pass
login_hint(user email) when opening the authorization page for pre-filling; if the email is not yet registered with Tencent eSign, the system automatically and silently completes registration and creates a default Space (the user is the admin). Nospace_idneeds to be passed; the user selects the Space on the authorization page - Designated Space Mode — The integrator passes both
space_idandlogin_hint. The system does not auto-create a Space; the user must have been pre-added as a pending member of that Space via the Pre-add Members API. Clicking “Agree” during authorization is treated as accepting the invitation and completing activation. See OAuth Authorization Flow - Designated Space Mode
- Open Mode — The integrator can pass
- Automatic app installation — When a user completes authorization on the Consent page, if the current Space has not yet installed the integration app and the user is an admin, Tencent eSign automatically completes the installation transparently to the user
- After the integrator application calls the Upload File API to obtain a
FileId, it binds theFileIdto the webview token via theOperateParam.FileIdsfield of the Get Embedded View URL API. The embedded page can use it immediately upon loading
Responsibilities
Integrator Responsibilities
| Phase | Function | Description |
|---|---|---|
| Pre-access | Console account and app management | Register integrator Space, create OAuth app, obtain / reset client_secret, bind billing resource packages; register in each region separately |
| Runtime | App UI entry points | Add initiate signing / signing status buttons in the toolbar / promotional area |
| Runtime | PKCE generation | Integrator application generates code_verifier / code_challenge |
| Runtime | OAuth authorization initiation | WebView opens the authorization URL; intercept custom-scheme callback to obtain auth code |
| Runtime | Member pre-addition (Designated Space Mode) | Call the Pre-add Members API to pre-add target users as pending members |
| Runtime | Token exchange and persistence | Call the Token Endpoint to exchange for access_token + refresh_token; store per your own security requirements |
| Runtime | Token refresh | Actively refresh access_token before it expires |
| Runtime | Embedded page URL retrieval | Call the Get Embedded View URL API |
| Runtime | WebView popup container | Load Tencent eSign embedded pages |
| Runtime | File upload and binding | Integrator application calls Upload File to get FileId, then binds it to the webview token via OperateParam.FileIds |
| Runtime | Custom scheme handling | Post-signing deep link redirect and not-installed fallback (see Embedded Views - Post-Signing Redirect) |
Tencent eSign Responsibilities
| Function | Description |
|---|---|
| OAuth authorization page | Supports login_hint / lang pre-filling; displays Space list and roles |
| Automatic app installation | Automatically completes app installation on admin’s first authorization |
| Embedded page URL issuance | Validates access_token and issues webview token |
| webview token validation | Extracts user_id / space_id / page type |
| Envelope creation and sending | Sends after the embedded page completes recipient/control configuration |
| Branding | Renders the embedded page according to the branding information submitted by the integrator (see Embedded Views - Branding) |