Login Failed Error for the registered user in Android using Parse
-
19-10-2022 - |
Question
I have already registered an user using the Parse registration process for parse.com.
ParseUser user = new ParseUser();
user.setUsername(mEtUname.getText().toString());
user.setPassword(mEtPwd.getText().toString());
user.setEmail(mEtEmail.getText().toString());
// other fields can be set just like with ParseObject
user.put("phone", "xxxxxxxxxx");
user.signUpInBackground(new SignUpCallback() {
@Override
public void done(com.parse.ParseException e) {
// TODO Auto-generated method stub
if (e == null) {
// Hooray! Let them use the app now.
Log.d("Testing", "registration successful ");
Toast.makeText(RegistrationScreen.this, "I am registered", Toast.LENGTH_LONG).show();
} else {
// Sign up didn't succeed. Look at the ParseException
// to figure out what went wrong
Log.d("Testing", "registration not successful "+e.getMessage());
}
}
});
}
After registration user is showing on the parse user list on browser on the Parse website. Now i am trying to login the user using the below code:
ParseUser.logInInBackground(username, pwd, new LogInCallback() {
@Override
public void done(ParseUser user, ParseException e) {
// TODO Auto-generated method stub
if (user != null) {
Log.d("Testing", "I am logged in");
} else {
// Signup failed. Look at the ParseException to see what
// happened.
switch (e.getCode()) {
case ParseException.USERNAME_TAKEN:
Log.d("Testing","Sorry, this username has already been taken.");
break;
case ParseException.USERNAME_MISSING:
Log.d("Testing","Sorry, you must supply a username to register.");
break;
case ParseException.PASSWORD_MISSING:
Log.d("Testing","Sorry, you must supply a password to register.");
break;
case ParseException.OBJECT_NOT_FOUND:
Log.d("Testing","Sorry, those credentials were invalid.");
break;
case ParseException.CONNECTION_FAILED:
Log.d("Testing","Internet connection was not found. Please see your connection settings.");
break;
default:
Log.d("Testing",e.getLocalizedMessage());
break;
}
But every time it is saying "sorry. log in failed invalid login credentials". I have checked first logout the user and then login. But result is same.
Can anyone please help.
Thanks, Arindam
No correct solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow