Third-Party Integrationiframe Embedding

iframe Embedding

Embed Tencent eSign pages into the integrator’s own web page: ask Tencent eSign operations to allowlist your host domain first, then use the OpenAPI-returned URL as an iframe.

Prerequisite: Allowlist Your Host Domain

Send your OAuth app client_id and host domains (e.g. https://app.your-company.com, wildcard subdomains like https://*.your-company.com are supported) to your Tencent eSign operations / integration contact. The allowlist takes effect with the next release. An allowlisted host is required — otherwise the iframe stays blank.

Embeddable Pages

ScenarioHow to get the URL
Initiate signing / signature status listGet Embedded View URL (request_signatures / signature_status)
SigningGet Signing Link (embedded signing)

Use the returned URL as-is: do not add or remove parameters, and do not change the domain. The client_id in the URL is what matches your allowlist.

Host Page

<iframe
  src="URL returned by the OpenAPI"
  style="width:100%;height:900px;border:0"
  sandbox="allow-scripts allow-same-origin allow-forms allow-popups allow-downloads allow-modals"
></iframe>

Keep allow-same-origin (without it API calls are sent with Origin: null and rejected). allow-top-navigation is not needed: the embedded page never navigates the host page.

Receiving the Result

Completion and decline are reported to the host via postMessage; validate the sender before acting:

window.addEventListener('message', (e) => {
  if (e.origin !== 'https://www.tencent-esign.com') return; // validate against your environment domain
  if (!e.data || e.data.source !== 'tencent-esign') return;
  // e.data.type: embed.ready | signing.complete | signing.decline
  // terminal messages also carry event / envelopeId / recipientId / returnUrl
});

The message payload uses these exact fields:

FieldTypeDescription
sourcestringAlways tencent-esign
typestringembed.ready, signing.complete, or signing.decline
clientIdstringOAuth app client_id from the embedded URL when present
envelopeIdstringEnvelope ID on terminal messages
recipientIdstringSigner recipient ID on terminal messages
eventstringTerminal result: signing_complete or decline
returnUrlstringValidated return URL supplied by the integrator, when present
typeevent
embed.readynot set
signing.completesigning_complete
signing.declinedecline

The message is a UI signal only; the authoritative envelope status comes from webhooks or the envelope detail API.

FAQ

SymptomFix
Blank iframeThe host domain is not allowlisted, or client_id was stripped/rewritten from the URL
No postMessage receivedHost does not validate the exact origin, the iframe has no height, or sandbox is missing allow-same-origin
Downloads / popups do nothingsandbox is missing allow-downloads / allow-popups
TOKEN_INVALID when opening the linkThe link expired or was replaced by a newer link for the same signer; issue a new one
Signer is asked to log inExpected for standard embedded signing (the sign-in card renders inside the iframe); contact operations if you need Trusted signing