Response Object
Response Object
-
When enforcement or detection is completed, the configured
onCompleted
function is invoked with aresponse
object. -
When an error occurs in loading the detection and/or enforcement, the
onError
callback function is invoked with aresponse
object. -
When the challenge is suppressed for enforcement or only detection is run, the
onSuppress
callback function is invoked with aresponse
object. -
When a warning occurs in loading the detection and/or enforcement, the
onWarning
callback function is invoked with aresponse
object.
The following only apply to our enforcement component:
-
When a challenge has failed, the configured
onFailed
function is invoked with aresponse
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 aresponse
object. -
When a challenge is loaded, the
onShown
callback function is invoked with aresponse
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 Field | Type | Description | Used by Callbacks |
---|---|---|---|
response.token | String | The token you need to send to your back-end server for verification. | onCompleted onFailed onShown onSuppress |
response.error | Error object | An error object containing an error code string (see next entry) | onError |
response.error.error | String | An error code string representing the error that occurred when loading the challenge. | onError |
response.height | String | Only applicable to our enforcement component. The challenge frame height size in px. e.g. "290px" | onCompleted onResize onShown onSuppress |
response.width | String | Only applicable to our enforcement component. The challenge frame width size in px. e.g. "302px" | onCompleted onResize onShown onSuppress |
response.maxHeight | String | Optional. Only applicable to our enforcement component. The maximum height of the challenge frame, in pixels (e.g. '450px'). | onCompleted onResize onShown onSuppress |
response.maxWidth | String | Optional. Only applicable to our enforcement component. The maximum width of the challenge frame, in pixels (e.g. '400px'). | onCompleted onResize onShown onSuppress |
response.completed | Boolean | Only applicable to our enforcement component. Indicates if the challenge is completed or not. | onCompleted onResize onShown onSuppress |
response.suppressed | Boolean | Only applicable to our enforcement component. Indicates if the challenge is suppressed or not. | onCompleted onResize onShown onSuppress |
response.warning | Warning Object | An object containing information about the warning (e.g. status, error, source). | onWarning |
Updated 6 days ago