Changing the User Password

A user can change the password by executing the changePassword method with the current and new passwords.

The user needs to be logged in for changing their password. Once the password is changed, the user needs to relogin with the new password.

  • String fromPassword = "myOldPassword";
    String toPassword = "myNewPassword";
    KiiUser user = KiiUser.getCurrentUser();
    
    try {
      // Change the password.
      user.changePassword(toPassword, fromPassword);
    } catch (IOException e) {
      // Handle the error.
    } catch (AppException e) {
      // Handle the error.
    }
  • String fromPassword = "myOldPassword";
    String toPassword = "myNewPassword";
    KiiUser user = KiiUser.getCurrentUser();
    
    // Change the password.
    user.changePassword(new KiiUserCallBack() {
      @Override
      public void onChangePasswordCompleted(int token, Exception exception) {
        if (exception != null) {
          // Handle the error.
          return;
        }
      }
    }, toPassword, fromPassword);