Skip to main content

Integrate widget using iFrame and events

Working with iframe

You can load widgets in an iframe, by giving the widgets' url as src.

<iframe src="{widgetUrl}/widget/add_connection"></iframe>

Some banks have prohibited the integration of their authentication website in iframe.

Redirection to the bank's website is inevitable when using a REDIRECT channel. Thanks to the addition of a query string parameter aspsp_callback_uri, the widgets resume the flow on a page of your choice. This paramater is Mandatory if widgets are loaded in an iframe, it must contain the URL which load the widgets.

Therefore, if user try to add a connection with a REDIRECT channel throw an iframe, you must provide to widgets both callback uri, with the aspsp_callback_uri and redirect_url parameters.

  • aspsp_callback_uri represents the page on your application where you want to load widgets.
  • redirect_url represents the page on your application where you want to be redirected when the widgets finish the process.
<iframe src="{widgetUrl}/widget/add_connection?aspsp_callback_uri=https://www.yourwebsite.com/display_iframe_page&redirect_uri=https://www.yourwebsite.com/your_redirect_uri"></iframe>

In the case we need a authentication in the bank website (REDIRECT channel definition), your main browser page will be redirected to the bank login page.

After the redirect flow, you'll be redirected to the aspsp_callback_uri you provided. This page have to recreate an iframe with widgets, exactly setted as above (with aspsp_callback_uri, again). The widgets will automatically rebuild the session.

Bank websites can't always be loaded in an iframe some because they have prohibited the integration of their authentication website in iframe.

An alternative to redirect URI to get events

Working with redirect_uri parameter cannot be a solution to retrieve results and statuses if the service is meant to be used through iframes or popups.

As a consequence widget service provides a way to retrieve these information by dispatching events via the use of postMessage which enables cross-origin communication between window objects. See https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage for more info about the technology.

Whenever the service is supposed to redirect to a client url with a given set of results and statuses, it also dispatches events providing these information (even when no redirect_url parameter is provided).

For example, when performing an 'Add Connection' flow within an Html iframe element, we make it possible for the parent window to be aware of the flow's result by adding an event listener on "message" events.

For a successful Add connection flow you can expect to get the following event data:

{
result: "created",
status: "success",
connection_id: "123456"
}

In the parent web application, subscribe to message events:

  window.addEventListener("message", (e) => {
// e.data will contain the useful data
console.log(e.data)
})

When the flow ends the above will catch the event and output:

{
result: "created",
status: "success",
connection_id: "123456"
}

Events list

Some events are "Global", they can spread from any Widget. They are the first of the list below and have the value "Global" in the column "Widget name".

For example, the event that warns that the widget has been resized spreads regardless of the widget currently displayed.

Widget nameEvent nameDescriptionTriggeringProperties
GlobalresizeReturns the new widget size after a resizeon widget resize{"innerWidth": int, "innerHeight": int, "outerWidth": int, "outerHeight": int}
GloballeaveThis event is triggered when the user clicks on the cross to close the widget or when the window is closedon click exit button{"client_id": "uuidv4", "redirect_uri": "url", "closing_type": "Button
Globalredirect_toThis event is triggered when the browser will redirect on the redirect_uriWhen user is redirected (change from a widget to another){"client_id": "uuidv4", "redirect_uri": "url"} + list of redirection parameters that depends of the parameters available (status, queue_id, connection_id ...)
Loginlogin_enterWhen the login widget is openedon load{"client_id": "uuidv4", "user_id": "int, optional"}
Loginlogin_submit_successA visitor submits his information. He is successfully logged and will be redirected on redirect urion click "Next Step" button{"client_id": "uuidv4", "user_id": "int", "email": "String"}
Loginlogin_submit_errorA visitor leaves the webview on login step. He will be redirected on partner redirect_uri or close containeron response error{"client_id": "uuidv4", "error": "String", "email": "String"}
Signupsignup_enterWhen the signup widget is openedon load{"client_id": "uuidv4", "user_id": "int, optional"}
Signupsignup_submit_step_1A visitor submits a valid email address. He goes on password + terms pageon click "Next Step" button{"client_id": "uuidv4", "email": "String"}
Signupsignup_open_termsA visitor opens the terms popinon click terms and conditions link{"client_id": "uuidv4"}
Signupsignup_submit_step_2_successA visitor submits his password. Terms is necessarily checked to submit. The redirect_uri is necessarily the widget add_connectionon click "Next Step" button{"client_id": "uuidv4", "terms": boolean}
Signupsignup_submit_step_2_errorA visitor submits his information. The server displays an error. It can be a connectivity error with server or an existing emailon response error{"client_id": "uuidv4", "error": "String", "email": "String"}
Recover Passwordrecover_password_enterWhen the recover password widget is openedon load{"client_id": "uuidv4", "user_id": "int, optional"}
Recover passwordrecover_password_submitA visitor submits his email to receive a recory password mail.on click button{"client_id": "uuidv4", "email": "String"}
Recover passwordrecover_password_errorAn error occured when the user submits the recovery email.on response error{"client_id": "uuidv4", "error": "String", "email": "String"}
Choose bankchoose_bank_enterWhen the choose bank widget is openedon load{"client_id": "uuidv4", "user_id": "int, optional"}
Choose bankchoose_bank_loading_errorThis event is triggered when the list of bank can not be loadedon response error{"client_id": "uuidv4", "error": "String", "user_id": int}
Choose bankchoose_bank_selectedThis event is triggered when the user select a bank and click on next step buttonon click "Next Step" button{"client_id": "uuidv4", "user_id": int, "bank_id": int, "bank_name": "String", "bank_branch_name": "String"}
PSD2 Consentpsd2_consent_authorize_url_successThis event is triggered after authorized url is requestedon response success{"client_id": "uuidv4", "user_id": "int", "bank_id": "int", "bank_name": "String", "bank_branch_name": "String", channel_definition_id: "int"}
PSD2 Consentpsd2_consent_authorize_url_failureThis event is triggered after authorized url is requestedon response error{"client_id": "uuidv4", "user_id": "int", "bank_id": "int", "bank_name": "String", "bank_branch_name": "String", channel_definition_id: "int"}
Bank loginbank_login_credential_enterWhen the bank login widget is openedon load{"client_id": "uuidv4", "user_id": "int, optional"}
Bank loginbank_login_credentialWe send this event for each credentials when the user click on next step buttonon click "Next Step" button{"client_id": "uuidv4", "user_id": int, "credential_id": int, "credential_type": "String (PWD, DOB**)", "credential_label": "String"} PWD = Password, **DOB = Date of birth
Synchronizationsynchronization_enterWhen the synchronization widget is openedon load{"client_id": "uuidv4", "user_id": "int, optional"}
Synchronizationsynchronization_startThis event is triggered at the start of the synchronization when the users enter.when the synchronization loads{"client_id": "uuidv4", "user_id": int, "started_at": timestamp, "captive": boolean}
Synchronizationchallenge_enterWhen the user encounter a challenge, he is sent on a page that asks him to act (confirm send challenge, challenge value). We want to track all challengeswhen the challenge loads{"client_id": "uuidv4", "user_id": int, "credential_id": int, "credential_type": "String (PWD*, DOB**)", "credential_label": "String"}
Synchronizationsynchronization_successWhen synchronization finish with successwhen the success container loads{"client_id": "uuidv4", "user_id": int, "ended_at": timestamp, "duration_time": float, "status": "String", "queue_id": "String"}
Synchronizationsynchronization_errorWhen synchronization finish with failurewhen the error container loads{"client_id": "uuidv4", "user_id": int, "ended_at": timestamp, "duration_time": float, "event_status": "String", "error": "String"}
Consentconsent_enterWhen the consent widget is openedon load{"client_id": "uuidv4", "user_id": "int, optional"}
Consentconsent_submit_successThe user accept consent (or close the window) and we send this event with the list of asked scopeson click "Next Step" button{"client_id": "uuidv4", "user_id": "int", "scopes": "String", "authorization": boolean}
Consentconsent_submit_errorAn error occurend when the user authorizes issuer to send data to partnerson response error{"client_id": "uuidv4", "user_id": "int", "scopes": "String", "error": "String"}
Consentconsent_for_accounts_successThe user gives consent for selected accountson submit button click{"client_id": "uuidv4", "user_id": "int", "queue_id": "String", "connection_id": "String", "channel_definition_id": "int"}
Consentconsent_for_accounts_failureThe user gives consent for selected accounts and an error occureson submit button click{"client_id": "uuidv4", "user_id": "int", "queue_id": "String", "connection_id": "String", "channel_definition_id": "int"}
Terms and conditionsterms_conditions_enterWhen the terms and conditions widget is openedon load{"client_id": "uuidv4", "user_id": "int, optional"}
Terms and conditionsterms_conditions_submit_successThe user accepts terms and authorize data sharingon click "Next Step" button{"client_id": "uuidv4", "user_id": "int", "accept_terms": boolean, "authorize": boolean}
Terms and conditionsterms_conditions_submit_errorAn error occurend when the user accepts terms and conditions and it failson response error{"client_id": "uuidv4", "user_id": "int", "accept_terms": boolean, "authorize": boolean, "error": "String"}
Terms and conditionsterms_conditions_open_termsA visitor opens the terms popin.on click terms and conditions link{"client_id": "uuidv4"}
Professional accountprofessional_account_enterWhen the professional account widget is openedon load{"client_id": "uuidv4", "user_id": "int, optional"}
Professional accountprofessional-account-list-loadedWhen the professional accounts list is loadedon load{"client_id": "uuidv4", "user_id": "int", "list": array or accounts}
Professional accountprofessional-account-current-itemWhen rendering an account item formon load{"client_id": "uuidv4", "user_id": "int", "account_id": "String"}
Professional accountprofessional-account-submit-successWhenever post information about an account succeedson click"Next Step" button
Professional accountprofessional-account-submit-errorWhenever post information about an account failson click "Next Step" button{"client_id": "uuidv4", "user_id": "int", "account_id": "String", "firstname": "String", "lastname": "String", "identification_number": "String", "type": "String", "optin": boolean, "error": "String"}
Professional accountprofessional-account-process-endWhen process is overon load{"client_id": "uuidv4", "user_id": "int"}
Professional accountprofessional-account-handle-user-infoWhen first name and last name screen is displayedon load{"client_id": "uuidv4", "user_id": "int", "firstname": "String", "lastname": "String"}
Professional accountprofessional-account-handle-user-info-submit-successWhen user changes profile info firstname and/or lastnameon click "Next Step" button{"client_id": "uuidv4", "user_id": "int", "firstname": "String", "lastname": "String"}