QR Flow Usage
The QR Code flow enables a cross-device scanning flow. The scan can be initiated on the web, or on the server and your user can complete the flow on their mobile device. This method makes use of the often superior camera capabilities of mobile devices. The level of customization available is similar to that of the Modal Flow.
Starting a QR Code verification
To begin the flow, perform a POST
request to the https://dyscanweb.dyneti.com/api/v1/scan
endpoint:
const response = await fetch("https://dyscanweb.dyneti.com/api/v1/scan", {
method: "POST",
headers: {
"X-API-KEY": "YOUR_PUBLISHABLE_KEY_HERE",
"Content-Type": "application/json",
},
body: JSON.stringify({
verify: {
// For non-protect scans this should be blank
},
options: {
// See scan configuration options
},
localization: {
// See localization options
},
}),
});
const parsedResponse = await response.json();
// show the QR code to the user
document.getElementById('qr-code-image').src = parsedResponse.qrCodeImageUrl;
You can show the QR code to the user by displaying the image referenced by the qrCodeImageUrl
property of the response. This response also includes the scanId
which you may wish to associate with the logged-in user. See below for the full response schema.
Response
{
scanFlowURL: String,
scanId: String,
qrCodeImageUrl: String
}
The verify
object supports the following options.
verify Request object
This object is used for our Protect integration but in this use case it should be blank.
const verify = {}
Getting the scan results
The results of the scan are available via the Scan API. The status
will be scanStarted
if the user has not opened the QR code URL yet.