Title
Create new category
Edit page index title
Edit category
Edit link
Create a session
Once you have added the Yoti SDK dependency to your project, you can use it to build and create your session as shown in the code snippet below:
xxxxxxxxxxconst path = require('path');const fs = require("fs"); const { IDVClient, SessionSpecificationBuilder, SdkConfigBuilder, NotificationConfigBuilder,} = require('yoti'); const CLIENT_SDK_ID = 'YOTI_CLIENT_SDK_ID'const PEM_PATH = 'YOTI_KEY_FILE_PATH'const PEM_KEY = fs.readFileSync(path.join(__dirname, PEM_PATH)); const idvClient = new IDVClient( CLIENT_SDK_ID, PEM_KEY ); idvClient .createSession(sessionSpec) .then((session) => { const sessionId = session.getSessionId(); const clientSessionToken = session.getClientSessionToken(); const clientSessionTokenTtl = session.getClientSessionTokenTtl(); console.log(sessionId); }) .catch((err) => { console.log(err) });Your session can be configured with the following:
- Preferences
- Scheme
- Notifications
Client Preferences
To create a session, please start by setting your preferences. For this purpose, the method sdkConfig builder is explained below. If parameters are not defined the default below will be set:
xxxxxxxxxx.withSdkConfig( new SdkConfigBuilder() .withAllowsCamera() .withPrimaryColour('#2d9fff') .withSecondaryColour('#FFFFFF') .withFontColour('#FFFFFF') .withPresetIssuingCountry('GBR') .withSuccessUrl(`${process.env.YOTI_APP_BASE_URL}/index`) .withErrorUrl(`${process.env.YOTI_APP_BASE_URL}/profile`) .withAllowHandoff(true) .build() )| Type | Parameter (examples) | Description |
|---|---|---|
| withPrimaryColour | #2d9fff(default), #ff0000 | Colours of the button provided in the frontend client as a hexadecimal RGB value. |
| withPresetIssuingCountry | USA, GBR | The user must select the issuing country of the document they are uploading. This setting determines which issuing country is selected by default. NOTE: Must be a 3 letter ISO 3166 code. |
| withSuccessUrl | https://yourdomain.com/success | If the upload/photo is successfully captured redirect your users here. Yoti will then begin to carry out the requested checks and tasks. If undefined, the page will not redirect and you can listen to Yoti's post messages on the same page. |
| withErrorUrl | https://yourdomain.com/error | If the upload/photo is unsuccessfully captured redirect your users here. If undefined, the user view will display an error screen, with the error code as a query parameter and won't redirect. (Details on the error codes can be found in [Client side user view](Client side user view)) |
| withAllowHandoff | true, false | if enabled will offer the user to transfer flow from desktop to a mobile device by scanning a QR code. |
Session Requirements
After that, specify the desired scheme in the identity profile requirements.
Single Schemes
You can specify the exact scheme that a user can be verified to, a full list of schemes can be found in this page below.
DBS BASIC:
xxxxxxxxxxconst advancedIdentityProfileScheme = new AdvancedIdentityProfileSchemeBuilder() .withType('DBS') .withObjective('BASIC') .withLabel('DBS-EXAMPLE') .build(); const advancedIdentityProfile = new AdvancedIdentityProfileBuilder() .withTrustFramework('UK_TFIDA') .withScheme(advancedIdentityProfileScheme) .build(); const advancedIdentityProfileRequirements = new AdvancedIdentityProfileRequirementsBuilder() .withProfile(advancedIdentityProfile) .build();CAN_CRC:
xxxxxxxxxxconst advancedIdentityProfileScheme = new AdvancedIdentityProfileSchemeBuilder() .withType('CAN_CRC') .withLabel('CAN-CRC-EXAMPLE') .build(); const advancedIdentityProfile = new AdvancedIdentityProfileBuilder() .withTrustFramework('YOTI_GLOBAL') .withScheme(advancedIdentityProfileScheme) .build(); const advancedIdentityProfileRequirements = new AdvancedIdentityProfileRequirementsBuilder() .withProfile(advancedIdentityProfile) .build();Dual Schemes
Yoti also gives the ability to use a combination or our schemes. This allows your users to meet multiple requirements within the same journey. For instance you can request a RTW scheme and a DBS scheme, users will be asked for a RTW documents first, then any additionally required DBS documents if DBS requirements have not already been met.
DBS + RTW:
xxxxxxxxxxconst advancedIdentityProfileSchemeRTW = new AdvancedIdentityProfileSchemeBuilder() .withType('RTW') .withLabel('label-for-RTW') .build(); const advancedIdentityProfileSchemeDBS = new AdvancedIdentityProfileSchemeBuilder() .withType('DBS') .withObjective('BASIC') .withLabel('label-for-DBS') .build(); const advancedIdentityProfileUKTFIDA = new AdvancedIdentityProfileBuilder() .withTrustFramework('UK_TFIDA') .withScheme(advancedIdentityProfileSchemeRTW) .withScheme(advancedIdentityProfileSchemeDBS) .build(); const advancedIdentityProfileRequirements = new AdvancedIdentityProfileRequirementsBuilder() .withProfile(advancedIdentityProfileUKTFIDA) .build();RTW + Share Code:
xxxxxxxxxxconst advancedIdentityProfileSchemeRTW = new AdvancedIdentityProfileSchemeBuilder() .withType('RTW') .withLabel('label-for-RTW') .build(); const advancedIdentityProfileUKTFIDA = new AdvancedIdentityProfileBuilder() .withTrustFramework('UK_TFIDA') .withScheme(advancedIdentityProfileSchemeRTW) .build(); const advancedIdentityProfileSchemeGbrRtwSharecode = new AdvancedIdentityProfileSchemeBuilder() .withType('GBR_RTW_SHARECODE') .withLabel('label-for-GBR-RTW-SHARECODE') .build(); const advancedIdentityProfileYotiGlobal = new AdvancedIdentityProfileBuilder() .withTrustFramework('YOTI_GLOBAL') .withScheme(advancedIdentityProfileSchemeGbrRtwSharecode) .build(); const advancedIdentityProfileRequirements = new AdvancedIdentityProfileRequirementsBuilder() .withProfile(advancedIdentityProfileUKTFIDA) .withProfile(advancedIdentityProfileYotiGlobal) .build();The sharecode scheme can be requested as a fallback. When this is active, users are first asked to present a passport from either the United Kingdom or Ireland. If they do not have one, they are given the option to provide a UK RTW share code. To use this fallback method the RTW scheme needs to be first scheme requested in the "profiles".
Multiple Schemes (DBS + RTW + Share Code)
xxxxxxxxxxconst advancedIdentityProfileSchemeRTW = new AdvancedIdentityProfileSchemeBuilder() .withType('RTW') .withLabel('label-for-RTW') .build(); const advancedIdentityProfileSchemeDBS = new AdvancedIdentityProfileSchemeBuilder() .withType('DBS') .withObjective('BASIC') .withLabel('label-for-DBS') .build(); const advancedIdentityProfileUKTFIDA = new AdvancedIdentityProfileBuilder() .withTrustFramework('UK_TFIDA') .withScheme(advancedIdentityProfileSchemeRTW) .withScheme(advancedIdentityProfileSchemeDBS) .build(); const advancedIdentityProfileSchemeGbrRtwSharecode = new AdvancedIdentityProfileSchemeBuilder() .withType('GBR_RTW_SHARECODE') .withLabel('label-for-GBR-RTW-SHARECODE') .build(); const advancedIdentityProfileYotiGlobal = new AdvancedIdentityProfileBuilder() .withTrustFramework('YOTI_GLOBAL') .withScheme(advancedIdentityProfileSchemeGbrRtwSharecode) .build(); const advancedIdentityProfileRequirements = new AdvancedIdentityProfileRequirementsBuilder() .withProfile(advancedIdentityProfileUKTFIDA) .withProfile(advancedIdentityProfileYotiGlobal) .build();Profiles - Trust Framework
Yoti supports two trust_frameworks:
- "UK_TFIDA". These are UK Government-certified identity workflows for DBS checks, Right to Work (RTW), and Right to Rent (RTR).
- "YOTI_GLOBAL". These are pre configured Yoti schemes that allow you to verify a users ID document, perform a biometric face match, share code check and verify their address if required.
Available Schemes
| Trust Framework | Scheme Type | Objective | Description |
|---|---|---|---|
| UK_TFIDA | RTW | N/A | UK certified right to work verification. |
| UK_TFIDA | RTR | N/A | UK certified right to rent verification. |
| UK_TFIDA | DBS | BASIC, STANDARD, ENHANCED | UK certified digital method for verifying a person's identity for criminal record checks |
| YOTI_GLOBAL | IDENTITY | AL_L1, AL_M1 | Yoti created Identity verification that can be set to a low assurance "L1" or a medium assurance "M1". The medium assurance adds a biometric face match. |
| YOTI_GLOBAL | IDENTITY_PLUS_ADDRESS | AL_L1, AL_M1 | Yoti created Identity verification that can be set to a low assurance "L1" or a medium assurance "M1". The medium assurance adds a biometric face match. An address check will also be performed. |
| YOTI_GLOBAL | GBR_RTW_SHARECODE | N/A | Yoti created verification that will fetch a users share code details and compare them to details extracted from a users Id documents. |
| YOTI_GLOBAL | CAN_CRC | N/A | Yoti created Identity verification that will verify a document and perform a biometric face match. For the Canadian Criminal Record Check. |
System Preferences
Then, specify the subject id and set the system preferences for your session.
xxxxxxxxxxconst subject = { subject_id: 'subject_id_string',}; const sessionSpec = new SessionSpecificationBuilder() .withClientSessionTokenTtl(600) .withResourcesTtl(90000) .withUserTrackingId('some-user-tracking-id') .withSubject(subject) .withAdvancedIdentityProfileRequirements(advancedIdentityProfileRequirements) .withSdkConfig(sdkConfig) .withNotifications(notificationConfig) .build();The table below explains the optional parameters for the session and data retention configuration.
| Parameters | Description | Optional |
|---|---|---|
| withClientSessionTokenTtl | This is how long the full Identity verification session is open for in seconds. This must be longer than 300s (5 minutes). | ✅ |
| withResourcesTtl | Retention period ("time to live") for uploaded documents/images in number of seconds. Default is one week ( Note: This config may result in additional charges. Please get in touch with support if considering a TTL longer than three months. | ✅ |
| withUserTrackingId | Allows the relying business backend to track the same user across multiple sessions. Note: This should not contain any personal identifiable information. | ✅ |
| WithSubject | Allows to track the same user across multiple sessions. Should not contain any personal identifiable information. | ✅ |
Got a question? Contact us here.