QoreID Web SDK
This guide provides information on how to integrate the QoreID SDK with your web application. With the QoreID SDK, you can more conveniently access QoreID services.
The Web SDK is launched with a session token minted by your backend viaPOST /v1/sessions— yourclientIdandsecretstay on your server, and the product (or workflow) is encoded inside the token. See SDK Session Tokens.
Requirements
- QoreID web SDK can be used on ECMAScript 5 and above-supported browsers. You can confirm your browser's version compatibility on caniuse.com.
Integration
Installation
npm install @qore-id/web-sdkyarn add @qore-id/web-sdkQuick Start
import QoreID from '@qore-id/web-sdk';
// Listen for events
QoreID.on('success', (data) => {
console.log('Verification successful:', data);
});
QoreID.on('error', (error) => {
console.error('Verification error:', error);
});
QoreID.on('close', (data) => {
console.error('Verification modal closed:', data);
});
QoreID.on('loading', (isLoading) => {
console.log('Loading:', isLoading);
});
// Start verification flow
await QoreID.start({
token: 'eyJ...', // required; from your backend (POST /v1/sessions)
customerReference: 'unique-reference',
applicantData: {
firstname: 'John',
lastname: 'Doe',
email: '[email protected]',
}, // optional
ocrAcceptedDocuments: "DRIVERS_LICENSE_NGA, VOTERS_CARD_NGA, NIN_SLIP_NGA" // optional
});Optional start Parameters
start Parameters
interface StartConfig {
token: string;
customerReference: string;
applicantData?: ApplicantData;
identityData?: IdentityData;
addressData?: AddressData;
ocrAcceptedDocuments?: string;
}
interface ApplicantData {
firstname: string;
middlename?: string;
lastname: string;
gender?: string;
/**YYYY-MM-DD */
dob?: string;
phone?: string;
email?: string;
}
interface IdentityData {
idType: string;
idNumber: string;
}
interface AddressData {
address: string;
city: string;
lgaName: string;
}