2

I'm trying to login using Parse for android. If I enter the correct username and password, I log in successfully. But when I use a wrong password or username, I always get error 101: object not found. Here's the code (Notice "username" and "password" are EditText):

private void doLogin() {
    if (!validate()) { // IF VALIDATION FAILS, DO NOTHING
        return;
    } // ELSE...
    String name = email.getText().toString();
    String pass = password.getText().toString();
    ParseUser.logInInBackground(name, pass, new LogInCallback() {
        public void done(ParseUser user, ParseException e) {
            if (user != null) {
                goToMainActivity(user.getUsername());
            } else {
                handleParseError(e);
            }
        }
    });
}

Thanks for your help.

3
  • 1
    What's your question? If your username and password are correct, you get logged in, and if they aren't, you get an error, which is exactly what should happen. You can handle that error as you like. Commented Jun 17, 2015 at 13:20
  • problem is I was expecting to get a more specific error (wrong password or wrong username?) Commented Jun 17, 2015 at 13:28
  • 1
    Unfortunately, that's the only error you're going to get in this case. Generally, you shouldn't tell your user if it's their username or password that is wrong, because you don't want to suggest that a user has provided, for example, a valid email that isn't their own, but an invalid password. You'll have to settle for letting the user know that either the password or username or both are incorrect. There are other errors here for when a connection fails, etc. but I believe that the issue you're encountering is by design. Commented Jun 17, 2015 at 13:35

1 Answer 1

2

Update: Parse does not have means to check if there was an incorrect login field. Hence they use the general 101: Object Not Found error to catch it. Reference: https://parse.com/docs/android/api/com/parse/ParseException.html
Previous stackoverflow link: Parse : invalid username, password

If you want your app to respond to an incorrect login, just replace the line handleParseError(e); with code to handle it.

For example, if you want a message box to show up, place that code there. If you do not want to do anything, comment out that line. Not sure what else you are looking for...

I would suggest replacing it with a Toast message

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks, handleParseError does exactly that (handles the error). Problem is, instead of getting a specific error (such as "Wrong password" or "Wrong username") i only receive the "object not found" error.
Looks like Wrong password or Wrong username does not exist. Take a look at the following possible ParseExceptions: parse.com/docs/android/api/com/parse/ParseException.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.