ValidateUserTask (new)

Used to verify a user's credentials.

On success, a session token will be returned that will be used to securely make calls to other REST API tasks.


ValidateUserTask
// This only needs to be executed one for the lifetime of the app.
SurePassServerTask.setSurePassServer("www.surepassid.com");
SurePassServerTask.setSurePassAccountName("ACCOUNT_NAME"); // optional
SurePassServerTask.setSurePassAccountKey("ACCOUNT_KEY"); // optional

String username = "demouser";
String password = "demosecret";

new ValidateUserTask().run(
        new ValidateUserTaskParams(username, password),
        new ValidateUserTaskListener() {
            @Override
            public void onResult(ValidateUserTaskResult result) {
                if (result.getErrorCode() == 0) {
                    // The username and password were valid.
                } else if (result.getErrorCode() == USER_VALIDATION_FAILED_ERROR) {
                    // The username or password was incorrect.
                } else {
                    // An error occurred while processing the request.
                }
            }
        }
);