Requesting the Embedded Verification Url
When creating or querying the details of a Case through the Public API the verification url can be requested as part of the application urls added to the API schema as outlined in this changelog. With the addition of the embedded API the verification
field has a new argument embedded
to return the verification url used for embedded EIV. An example GraphQL request creating a new case and querying the appropriate details is shown below.
mutation CreateCase($input: CreateCaseForIndividualsInput!) {
createCaseForIndividuals(input: $input) {
__typename
... on CaseInformation {
caseId
individuals {
individualId
urls {
verification(embedded: true) {
... on ValidUrl {
url
}
... on InvalidUrl {
url
}
}
}
}
}
... on ValidationErrors {
errors {
message
fieldPath
}
}
}
}
Hosting the iframe
Using the verification url is straight forward with the most important callout being the permissions required for camera
and microphone
.
<iframe title="Identity Verification" allow="camera;microphone" src="{verificationUrl}"></iframe>
Terminal state
The final state of the iframe in embed mode will be a loading indicator in the UI regardless of the verification result.
As the consuming application you’ll need to intercept the messages posted from the iframe (see next section) to decide what to do next - for example, unmount the iframe and display your own UI to the user.
Messages from the iframe
The iframe will post messages to the hosting website to inform you of the status of the verification complete.
The Typescript definitions of the messages is as follows. The most common outcome will be VerificationUndeterminedMessage
due to the time taken to verify an individual, however some verification types will reduce this time.
export type VerificationCompleteMessage = {
type: 'verification_complete'
data: {
token: string
}
}
export type VerificationIncompleteMessage = {
type: 'verification_incomplete'
data: {
token: string
}
}
export type VerificationUndeterminedMessage = {
type: 'verification_undetermined'
data: {
token: string
}
}
export type ErrorMessage = {
type: 'error'
data: {
errorCode: ErrorCode
}
}
export type ErrorCode = 'generic'
export type IframeMessage =
| VerificationCompleteMessage
| VerificationIncompleteMessage
| VerificationUndeterminedMessage
| ErrorMessage