Overview
The web integration approach allows you to integrate IgniSign into your web applications using iframes for embedded integration or redirects for BySide integration. This page provides detailed implementation instructions for both methods.
Embedded Integration with iframe
The embedded integration approach integrates the IgniSign signing interface directly into your application using an iframe, providing a seamless user experience.
Here's a basic implementation of embedded signature using an iframe:
<!-- Container for the signature iframe -->
<div id="signature-container" style="width: 100%; height: 700px;">
<iframe
id="signature-iframe"
src="https://client-sign.ignisign.io/signature-requests/{signatureRequestId}/signers/{signerId}/sign?token={signatureSessionToken}&signerSecret={signerAuthSecret}"
style="width: 100%; height: 100%; border: none;"
allowfullscreen
></iframe>
</div>
// Listen for messages from the iframe
window.addEventListener('message', function(event) {
// Verify the origin for security
if (event.origin !== 'https://client-sign.ignisign.io') return;
const { type, data } = event.data;
switch (type) {
case 'IGNISIGN_COMPLETE':
console.log('Signature completed successfully', data);
// Handle successful signature
break;
case 'IGNISIGN_ERROR':
console.error('Error during signature process', data);
// Handle error
break;
case 'IGNISIGN_CANCELED':
console.log('Signature was canceled', data);
// Handle cancellation
break;
case 'IGNISIGN_PROGRESS':
console.log('Signature progress update', data);
// Handle progress updates
break;
}
});
For a more convenient integration, you can use our JavaScript SDK:
<!-- Include the IgniSign JavaScript SDK -->
<script src="https://cdn.ignisign.io/ignisign-js/v2/ignisign.min.js"></script>
<!-- Container for the signature interface -->
<div id="signature-container" style="width: 100%; height: 700px;"></div>
// Initialize the IgniSign client
const ignisign = new Ignisign.Client({
container: document.getElementById('signature-container'),
onComplete: (data) => {
console.log('Signature completed successfully', data);
// Handle successful signature
},
onError: (error) => {
console.error('Error during signature process', error);
// Handle error
},
onCancel: (data) => {
console.log('Signature was canceled', data);
// Handle cancellation
},
onProgress: (data) => {
console.log('Signature progress update', data);
// Handle progress updates
}
});
// Load the signature interface
ignisign.loadSignature({
signatureRequestId: 'your-signature-request-id',
signerId: 'your-signer-id',
signatureSessionToken: 'your-signature-session-token',
signerAuthSecret: 'your-signer-auth-secret'
});
When implementing embedded signature, consider these security aspects:
- Always verify the origin of messages from the iframe
- Use HTTPS for all communications
- Implement proper token handling and validation
- Set appropriate Content Security Policy (CSP) headers
BySide Integration with Email Delivery
The BySide integration approach relies on IgniSign sending an email with a signature link directly to the signer, who then completes the process on the IgniSign platform.
Here's a basic implementation of BySide signature, focusing on creating the signature request:
// Server-side code to create a signature request
const { IgnisignSdk } = require('@ignisign/ignisign-sdk');
// Initialize the SDK
const ignisign = new IgnisignSdk({
appId: 'YOUR_APP_ID',
appEnv: 'DEVELOPMENT', // or 'STAGING', 'PRODUCTION'
appSecret: 'YOUR_APP_SECRET'
});
await ignisign.init();
// Create a signature request with a return URL
const createSignatureRequest = async () => {
try {
// Create a signer (or use an existing one)
const signerResponse = await ignisign.createSigner({
email: '[email protected]',
firstName: 'John',
lastName: 'Doe'
});
// Create a signature request
const signatureRequest = await ignisign.createSignatureRequest({
title: 'Contract Signature',
documents: [
{
documentId: 'YOUR_DOCUMENT_ID'
}
],
signers: [
{
signerId: signerResponse.signerId,
role: 'SIGNER'
}
],
options: {
redirectUrl: 'https://your-app.com/signature-complete',
// The signer will be redirected to this URL after signing
}
});
console.log('Signature request created. An email has been sent to the signer.');
return signatureRequest;
} catch (error) {
console.error('Error creating signature request:', error);
throw error;
}
};
// Server-side handler for the return URL
const express = require('express');
const app = express();
app.get('/signature-complete', (req, res) => {
// Get the status from query parameters
const status = req.query.status;
const signatureRequestId = req.query.signatureRequestId;
// Handle different statuses
switch (status) {
case 'completed':
res.render('signature-success', { signatureRequestId });
break;
case 'canceled':
res.render('signature-canceled', { signatureRequestId });
break;
case 'error':
res.render('signature-error', { signatureRequestId, error: req.query.error });
break;
default:
res.render('signature-unknown', { signatureRequestId });
}
});
app.listen(3000, () => {
console.log('Server running on port 3000');
});
You can also use our JavaScript SDK for BySide integration:
<!-- Include the IgniSign JavaScript SDK -->
<script src="https://cdn.ignisign.io/ignisign-js/v2/ignisign.min.js"></script>
<!-- Button to trigger signature -->
<button id="sign-button">Sign Document</button>
// Initialize the IgniSign client
const ignisign = new Ignisign.Client();
// When your button is clicked
document.getElementById('sign-button').addEventListener('click', function() {
// Redirect to the signature page
ignisign.redirectToSignature({
signatureRequestId: 'your-signature-request-id',
signerId: 'your-signer-id',
returnUrl: 'https://your-app.com/signature-complete'
});
});
Advanced Customization
The IgniSign signature interface offers several customization options for web integration:
You can customize the signature interface by adding query parameters to the URL:
Parameter | Description | Example |
---|---|---|
hideTitle | Hides the title bar | hideTitle=true |
darkMode | Enables dark mode | darkMode=true |
returnUrl | URL to redirect to after completion | returnUrl=https://example.com/complete |
lang | Interface language | lang=fr |
Example URL with customizations:
https://client-sign.ignisign.io/signature-requests/{signatureRequestId}/signers/{signerId}/sign?hideTitle=true&darkMode=true&lang=fr&returnUrl=https://your-app.com/complete
When embedding the signature interface in an iframe, consider these responsive design tips:
- Dynamic Height: Allow the iframe to adjust its height based on content
- Mobile Optimization: Test your integration on various screen sizes
- Minimum Width: Ensure the container is at least 320px wide for mobile devices
- Safe Height: Use a minimum height of 500px for the container
Framework Integration Examples
import React, { useEffect, useRef } from 'react';
function SignatureComponent({ signatureRequestId, signerId, signatureSessionToken, signerAuthSecret }) {
const containerRef = useRef(null);
useEffect(() => {
// Load the IgniSign SDK
const script = document.createElement('script');
script.src = 'https://cdn.ignisign.io/ignisign-js/v2/ignisign.min.js';
script.async = true;
script.onload = () => {
// Initialize IgniSign client
const ignisign = new window.Ignisign.Client({
container: containerRef.current,
onComplete: (data) => {
console.log('Signature completed successfully', data);
// Handle successful signature
},
onError: (error) => {
console.error('Error during signature process', error);
// Handle error
},
onCancel: (data) => {
console.log('Signature was canceled', data);
// Handle cancellation
}
});
// Load the signature interface
ignisign.loadSignature({
signatureRequestId,
signerId,
signatureSessionToken,
signerAuthSecret
});
};
document.body.appendChild(script);
return () => {
// Clean up
document.body.removeChild(script);
};
}, [signatureRequestId, signerId, signatureSessionToken, signerAuthSecret]);
return (
<div className="signature-container" ref={containerRef} style={{ width: '100%', height: '700px' }}></div>
);
}
export default SignatureComponent;
<template>
<div class="signature-container" ref="signatureContainer" style="width: 100%; height: 700px;"></div>
</template>
<script>
export default {
name: 'SignatureComponent',
props: {
signatureRequestId: {
type: String,
required: true
},
signerId: {
type: String,
required: true
},
signatureSessionToken: {
type: String,
required: true
},
signerAuthSecret: {
type: String,
required: true
}
},
mounted() {
// Load the IgniSign SDK
const script = document.createElement('script');
script.src = 'https://cdn.ignisign.io/ignisign-js/v2/ignisign.min.js';
script.async = true;
script.onload = () => {
// Initialize IgniSign client
const ignisign = new window.Ignisign.Client({
container: this.$refs.signatureContainer,
onComplete: (data) => {
console.log('Signature completed successfully', data);
this.$emit('signature-complete', data);
},
onError: (error) => {
console.error('Error during signature process', error);
this.$emit('signature-error', error);
},
onCancel: (data) => {
console.log('Signature was canceled', data);
this.$emit('signature-cancel', data);
}
});
// Load the signature interface
ignisign.loadSignature({
signatureRequestId: this.signatureRequestId,
signerId: this.signerId,
signatureSessionToken: this.signatureSessionToken,
signerAuthSecret: this.signerAuthSecret
});
};
document.body.appendChild(script);
},
beforeDestroy() {
// Clean up
const script = document.querySelector('script[src="https://cdn.ignisign.io/ignisign-js/v2/ignisign.min.js"]');
if (script) {
document.body.removeChild(script);
}
}
};
</script>
import { Component, ElementRef, Input, OnInit, ViewChild } from '@angular/core';
declare global {
interface Window {
Ignisign: any;
}
}
@Component({
selector: 'app-signature',
template: `<div #signatureContainer class="signature-container" style="width: 100%; height: 700px;"></div>`
})
export class SignatureComponent implements OnInit {
@Input() signatureRequestId: string;
@Input() signerId: string;
@Input() signatureSessionToken: string;
@Input() signerAuthSecret: string;
@ViewChild('signatureContainer') container: ElementRef;
constructor() { }
ngOnInit(): void {
// Load the IgniSign SDK
const script = document.createElement('script');
script.src = 'https://cdn.ignisign.io/ignisign-js/v2/ignisign.min.js';
script.async = true;
script.onload = () => {
this.initializeSignature();
};
document.body.appendChild(script);
}
private initializeSignature(): void {
// Initialize IgniSign client
const ignisign = new window.Ignisign.Client({
container: this.container.nativeElement,
onComplete: (data) => {
console.log('Signature completed successfully', data);
// Handle successful signature
},
onError: (error) => {
console.error('Error during signature process', error);
// Handle error
},
onCancel: (data) => {
console.log('Signature was canceled', data);
// Handle cancellation
}
});
// Load the signature interface
ignisign.loadSignature({
signatureRequestId: this.signatureRequestId,
signerId: this.signerId,
signatureSessionToken: this.signatureSessionToken,
signerAuthSecret: this.signerAuthSecret
});
}
ngOnDestroy(): void {
// Clean up
const script = document.querySelector('script[src="https://cdn.ignisign.io/ignisign-js/v2/ignisign.min.js"]');
if (script) {
document.body.removeChild(script);
}
}
}
Common Issues and Solutions
Issue | Solution |
---|---|
X-Frame-Options blocking iframe | Ensure you're using the correct domain for embedding. The IgniSign signature interface is served from client-sign.ignisign.io which allows embedding. |
Event messages not being received | Make sure you're listening for messages correctly and verifying the origin. Check browser console for any errors. |
Iframe not resizing properly | Use a container with appropriate CSS to ensure the iframe can resize properly. Consider using max-width and max-height with percentage values. |
Return URL not working | Make sure your return URL is properly URL-encoded and includes the http:// or https:// prefix. |
Next Steps
Now that you understand how to integrate the IgniSign signature interface into your web applications, you might want to explore:
- JavaScript SDK Documentation for more details on client-side integration
- Webhooks Integration for real-time event notifications
- Signature Request Configuration for advanced signature settings