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.

  • When a warning occurs in loading the detection and/or enforcement, the onWarning 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);
},
onWarning: function(response) {
  // sendScriptLoadingWarningToBackendServer(response.warning);
},
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);
},
  
onWarning: function(response) {
  // sendScriptLoadingWarningToBackendServer(response.warning);
}
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
response.maxHeightStringOptional. Only applicable to our enforcement component.

The maximum height of the challenge frame, in pixels (e.g. '450px').
onCompleted
onResize
onShown
onSuppress
response.maxWidthStringOptional. Only applicable to our enforcement component.

The maximum width of the challenge frame, in pixels (e.g. '400px').
onCompleted
onResize
onShown
onSuppress
response.completedBooleanOnly applicable to our enforcement component.

Indicates if the challenge is completed or not.
onCompleted
onResize
onShown
onSuppress
response.suppressedBooleanOnly applicable to our enforcement component.

Indicates if the challenge is suppressed or not.
onCompleted
onResize
onShown
onSuppress
response.warningWarning ObjectAn object containing information about the warning (e.g. status, error, source).onWarning