ForgeRock SDKs

Error handling

When an error occurs during the registration or authentication process, the Android SDK returns the WebAuthnResponseException exception. In most cases, errors are returned as per the specification. The error code can be found from WebAuthnResponseExcetpion.getErrorCode().

Error handling with AM node outcome

When you use WebAuthnRegistrationCallback.register() or `WebAuthnAuthenticationCallback.authenticate(), the SDK automatically parses the error into the appropriate format for AM. When AM receives the node, the authentication flow follows the WebAuthn registration process to reach the appropriate outcome.

However, if the error has to be handled manually, the WebAuthnResponseException provides a convenience method called WebAuthnResponseException.toServerError() to convert the error into an appropriate format.

callback.register(this, node, new FRListener<Void>() {
    public void onSuccess(Void result) {

    public void onException(Exception e) {
        if (e instanceof WebAuthnResponseException) {
            WebAuthnResponseException exception = (WebAuthnResponseException) e;
            exception.getErrorCode(); //Do something with the error or proceed to the next node.

WebAuthnResponseExcetpion.getErrorCode() == results in an Unsupported outcome in both WebAuthn Registration node and WebAuthn Authentication node.

Any other WebAuthnResponseExcetpion.getErrorCode() results in a Client Error outcome in the nodes.

Copyright © 2010-2022 ForgeRock, all rights reserved.