When our browser-based KYC workflows are run in an HTML iframe
, it is good to set up an event listener on the parent window, to get a JS-event notification when the login workflow is completed either with a success or an error.
See MDN Mozilla Developer Network – Window.postMessage()
Setup Eventlistener
HTML and Javascript example:
Event Data Returned on Error message
Json example:
{ "product": "SCANNING", "payload": { "errorCode": "LINK_EXPIRED", "errorDetails": "The link is already used or expired", "relayState": "12345", "sessionId": "b67a91f8-3a33-474d-91b2-6669a435bc40", "sessionStatus": "OperatorRequired" } }
Event Data Returned on Successful Scanning
Json example:
{ "product": "SCANNING", "payload": { "sessionId": "b91f2898-7b35-489e-b0d2-cbb783ac340f", "sessionStatus": "Accepted", "relayState": null, "errorCode": null, "errorDetails": null } }