Response Object

Response Object

  • When enforcement or detection is completed, the configured onCompleted function is invoked with a response object.

  • When an error occurs in loading the detection and/or enforcement, the onError callback function is invoked with a response object.

  • When the challenge is suppressed for enforcement or only detection is run, the onSuppress callback function is invoked with a response object.

The following only apply to our enforcement component:

  • When a challenge has failed, the configured onFailed function is invoked with a response object. By "failed", we mean the user has incorrectly answered a challenge more than a configured number of times. Please contact your CSM (Customer Success Manager) or SE for additional information if needed.

  • When a challenge is loaded, the configured onResize function is invoked with a response object.

  • When a challenge is loaded, the onShown callback function is invoked with a response object.

The following code templates suggest how to handle each function's callback and how to pass the response object or its relevant fields. It is followed by a table with descriptions of the response object's fields.

onCompleted: function(response) {
  // sendToBackendServer(response.token);
},
onFailed: function(response) {
  // sendUserChallengeFailedToBackendServer(response.token);
},
onError: function(response) {
  // sendScriptLoadingErrorToBackendServer(response.error);
},
onResize: function(response) {
  // optionally handle sizing events as needed on the client-side with response.height and response.width data
},
onShown: function(response) {
  // optionally handle shown event as needed on the client-side
},
onSuppress: function(response) {
  // optionally handle suppressed events as needed on the client-side
}
onCompleted: function(response) {
  // sendToBackendServer(response.token);
},
  
onError: function(response) {
  // sendScriptLoadingErrorToBackendServer(response.error);
}
Response Object FieldTypeDescriptionUsed by Callbacks
response.tokenStringThe token you need to send to your back-end server for verification.onCompleted
onFailed
onShown
onSuppress
response.errorError objectAn error object containing an error code string (see next entry)onError
response.error.errorStringAn error code string representing the error that occurred when loading the challenge.onError
response.heightStringOnly applicable to our enforcement component.

The challenge frame height size in px. e.g. "290px"
onCompleted
onResize
onShown
onSuppress
response.widthStringOnly applicable to our enforcement component.

The challenge frame width size in px. e.g. "302px"
onCompleted
onResize
onShown
onSuppress