Quick start
We suggest you read through the step by step integration guide to understand the integration in detail. Please see below for example code snippets and example projects.
Example code
Below is an example complete request snippet in different languages.
Install the Yoti SDK
npm install -S -E yoti
const yoti = require('yoti')
const CLIENT_SDK_ID = 'YOTI_CLIENT_SDK_ID'
const PEM_PATH = 'YOTI_KEY_FILE_PATH'
const PEM_KEY = fs.readFileSync(PEM_PATH)
// For SDK version < 3
const yotiClient = new yoti(CLIENT_SDK_ID, PEM)
// For SDK version >= 3
const yotiClient = new yoti.Client(CLIENT_SDK_ID, PEM_KEY)
Yoti QR button
You can add the Yoti QR button to your site using either the JavaScript (JS) approach or the NPM module method. The JS method uses a script tag and global object, while the NPM approach lets you install the package and use imports. See below for both examples, and feel free to look at our other examples.
<!-- Simple Modal Button Generation -->
<head>
<script src="https://www.yoti.com/share/client/"></script>
</head>
<body>
<!-- Yoti element will be rendered inside this DOM node -->
<div id="xxx"></div>
<!-- This script snippet will also be required in your HTML body -->
<script>
window.Yoti.Share.init({
elements: [
{
domId: "xxx",
scenarioId: "xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
clientSdkId: "xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
displayLearnMoreLink: true,
}
]
});
</script>
</body>
Retrieve profile
yotiClient.getActivityDetails(oneTimeUseToken)
.then((activityDetails) => {
const rememberMeId = activityDetails.getRememberMeId();
const parentRememberMeId = activityDetails.getParentRememberMeId();
const receiptId = activityDetails.getReceiptId();
const timestamp = activityDetails.getTimestamp();
const profile = activityDetails.getProfile();
const applicationProfile = activityDetails.getApplicationProfile();
const selfieImageData = profile.getSelfie().getValue();
const base64SelfieUri = profile.getSelfie().getValue().getBase64Content();
const fullName = profile.getFullName().getValue();
const familyName = profile.getFamilyName().getValue();
const givenNames = profile.getGivenNames().getValue();
const phoneNumber = profile.getPhoneNumber().getValue();
const emailAddress = profile.getEmailAddress().getValue();
const dateOfBirth = profile.getDateOfBirth().getValue();
const postalAddress = profile.getPostalAddress().getValue();
const structuredPostalAddress = profile.getStructuredPostalAddress().getValue();
const gender = profile.getGender().getValue();
const nationality = profile.getNationality().getValue();
const ageVerifications = profile.getAgeVerifications();
const ageVerified = profile.findAgeVerification('age_over:', 18).getValue(); // or 'age_under:'
const documentDetails = profile.getDocumentDetails().getValue();
const applicationName = applicationProfile.getName().getValue();
const applicationUrl = applicationProfile.getUrl().getValue();
const applicationLogo = applicationProfile.getLogo().getValue();
const applicationReceiptBgColor = applicationProfile.getReceiptBgColor().getValue();
// You can retrieve the sources and verifiers for each attribute as follows
const givenNamesObj = profile.getGivenNames()
const givenNamesSources = givenNamesObj.getSources(); // list/array of anchors
const givenNamesVerifiers = givenNamesObj.getVerifiers(); // list/array of anchor
// You can also retrieve further properties from these respective anchors in the following way:
// Retrieving properties of the first anchor
const value = givenNamesSources[0].getValue(); // string
const subtype = givenNamesSources[0].getSubType(); // string
const timestamp = givenNamesSources[0].getSignedTimeStamp().getTimestamp(); // Date object
const originServerCerts = givenNamesSources[0].getOriginServerCerts(); // list of X509 certificates
})
Web examples
Our GitHub pages are listed below for the Digital ID Integration. Please select your preferred language to continue.
Identity access management platform
We have built a node (or marketplace app) for ForgeRock BackStage. This means that companies that have integrated with ForgeRock can simply integrate the Yoti node, which is already compatible with ForgeRock Access Manager. Now the many organisations that use ForgeRock can quickly integrate with Yoti, using it to sign in to their platforms or verify their users.