OtpMobileAuthHandler
OTP mobile authentication Handler
Introduction
When a user is enrolled for mobile authentication, they are able to receive and respond to mobile authentication requests. After initiating an OTP request, the Onegini Cordova plugin returns a MobileAuthenticationHandler
object, which can be used to register callbacks which will be called when certain OTP mobile authentication steps are required.
Example: When an OTP mobile authentication request is initiated the onConfirmationRequest
callback will be called.
When onConfirmationRequest
is called, the user should be prompted to either accept or deny the OTP mobile authentication request. Once the user has made a choice, it can be supplied to the Onegini Cordova Plugin by calling an action
, in this case accept
or deny
. The UI to do this is left up to the developer. The following example shows the general strategy to do this.
If the request and responses were valid, the onSuccess
handler will be called.
Methods
The following methods can be registered to handle different mobile authentication request types.
![copy link to clipboard](../../../../../theme/img/icon-link.svg)
onConfirmationRequest
This method is called on a mobile authentication request with the push method. The request can either be accepted using actions.accept
or denied using actions.deny
.
![copy link to clipboard](../../../../../theme/img/icon-link.svg)
onSuccess
This method is called when the user has successfully accepted the mobile authentication request. At this point, the authentication request is considered completed, and another push notification can be handled.
![copy link to clipboard](../../../../../theme/img/icon-link.svg)
onError
This method is called when the user has denied the mobile authentication request, the user has failed to authenticate themselves, or an error has occurred. At this point, the authentication request is considered completed, albeit failed. Another push notification can be handled.