Create a session
Once you have added the Yoti SDK dependency to your project, you can use it to build and send your session as shown in the code snippet below:
x
const path = require('path');
const fs = require("fs");
const {
IDVClient,
SessionSpecificationBuilder,
RequestedDocumentAuthenticityCheckBuilder,
RequestedLivenessCheckBuilder,
RequestedTextExtractionTaskBuilder,
RequestedFaceMatchCheckBuilder,
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 is configured to with the following:
- Preferences
- Each check and task
- Notifications
We go into more details over the next few pages on granular detail for creating a session.
Recommendation
Yoti strongly recommends you use notifications for each session status.
Was this page helpful?