User can't login after signing up

When I sign up a user everything seems to be working. But as soon as I want to login the user I get the error code 3003 no matter what I input. This is the code that happens after I press the login button.
mLoginButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String username = mUsername.getText().toString();
String password = mPassword.getText().toString();

    username = username.trim();
    password = password.trim();

    if (username.isEmpty() || password.isEmpty()) {
        AlertDialog.Builder builder = new AlertDialog.Builder(LoginActivity.this);
        builder.setMessage(R.string.login_error_message)
                .setTitle(R.string.login_error_title)
                .setPositiveButton(android.R.string.ok, null);
        AlertDialog dialog = builder.create();
        dialog.show();
    } else {

        Backendless.UserService.login(username, password, new AsyncCallback<BackendlessUser>() {
            @Override
            public void handleResponse(BackendlessUser backendlessUser) {
                Intent intent = new Intent(LoginActivity.this, MainActivity.class);
                intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
                startActivity(intent);
            }


            public void handleFault(BackendlessFault fault) {
                // an error has occurred, the error code can be retrieved with fault.getCode()
                AlertDialog.Builder builder = new AlertDialog.Builder(LoginActivity.this);
                builder.setMessage(fault.getCode())
                        .setTitle(R.string.error_title)
                        .setPositiveButton(android.R.string.ok, null);
                AlertDialog dialog = builder.create();
                dialog.show();
            }
        });

    }
}

});

Hi Jordan,

3003 indicates that either username or password is incorrect. Try resetting user’s password using Backendless Console (as a test) and see if the login code works. Perhaps the code which registers users is not entirely “symmetric” with the login code?

Regards,
Mark

Hi Mark,

Thanks for the quick response. I’m still having trouble with the code even after resetting the user’s password. This is my code from Sign Up Activity where I register my users once the signUpButton has been pressed.

mSignUpButton.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        String username = mUsername.getText().toString();
        String password = mPassword.getText().toString();
        String email = mEmail.getText().toString();


        username = username.trim();
        password = password.trim();
        email = email.trim();


        if ( username.isEmpty() || password.isEmpty() || email.isEmpty()) {
            AlertDialog.Builder builder = new AlertDialog.Builder(SignUpActivity.this);
            builder.setMessage(R.string.signup_error_message)
                    .setTitle(R.string.error_title)
                    .setPositiveButton(android.R.string.ok, null);
            AlertDialog dialog = builder.create();
            dialog.show();
            }
        else {
            //Create the new user
            BackendlessUser user = new BackendlessUser();
            user.setEmail(email);
            user.setPassword(password);
            user.setProperty("username", username);


            Backendless.UserService.register(user, new AsyncCallback<BackendlessUser>() {
                public void handleResponse(BackendlessUser registeredUser) {
                    // user has been registered and now can login
                    Intent intent = new Intent(SignUpActivity.this, LoginActivity.class);
                    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
                    startActivity(intent);
                }


                public void handleFault(BackendlessFault fault) {
                    // an error has occurred, the error code can be retrieved with fault.getCode()
                    AlertDialog.Builder builder = new AlertDialog.Builder(SignUpActivity.this);
                    builder.setMessage("Something went wrong!")
                            .setTitle(R.string.error_title)
                            .setPositiveButton(android.R.string.ok, null);
                    AlertDialog dialog = builder.create();
                    dialog.show();
                }
            });


        }
    }
});

Thanks,Jordan

Hi Jordan,

Could you please check what property is marked as “identity” in Backendless?

Regards,
Mark

Hi Mark,

The email property is set to identity.

Thanks,
Jordan

On the login screen, do you enter an email address for the “mUsername” variable?

Hi Mark,

I figured out that I had to change my custom property for username to identity in Backendless. Now it allows the user to login. But, now it will only let me login if the user switches the activity (I.E. Sign up screen) and goes back to the login screen?
I really appreciate the help!

Thanks,
Jordan.

Hi Jordan,

Sorry, I didn’t understand your question:
“now it will only let me login if the user switches the activity (I.E. Sign up screen) and goes back to the login screen?”

Can you elaborate or perhaps rephrase it?

Mark

Hi Mark,

When I first run my app it brings up the login screen. When the user logins I receive an error code using Backendless’s fault.getCode(); that says “Illegal Argument Exception” and I keep getting the same error code until the user switches activities and returns to the login screen and tries again. Then for some reason it allows the user to login after that without a problem.

Hope I better explained the problem.
Jordan

I am too facing the same problem. Please help.

Hi Jordan,

Did you find any solution for this ?