Change PIN
Introduction
The UserClient
offers a method to change PIN for currently logged in user profile. This methods is called changePin
and requires one argument:
OneginiChangePinHandler
the changed PIN handler to return the result of change PIN action.
The SDK will handle flow of changing the PIN using OneginiPinAuthenticationRequestHandler
and OneginiCreatePinRequestHandler
handlers. Please read Authenticate user with PIN topic guide to learn how to implement those two handlers and how to cancel PIN change process.
Handler methods
void onSuccess()
is called when PIN was changed.void onError(final OneginiChangePinError oneginiChangePinError)
is called when some error during changing PIN occurred.
Example code for changing PIN
For more info on error handling see the Error handling topic guide.
As you can see in the example above we handle only one error case - when user got deregistered (probably due to too many failure PIN attempts). Please note
that you can handle errors that are relevant to you differently. To accomplish that you should compare the OneginiChangePinError#getErrorType()
value with
the OneginiChangePinError
error type definitions. The OneginiChangePinError
will also contain an additional error description for debugging and possibly a
Throwable
object which you can get with the getMessage()
and getCause()
methods.