Currently, I am experimenting with the Angular Meteor tutorial that utilizes Ionic to build a WhatsApp Clone. I decided to modify the phone verification process and opted for a standard user setup using username/password instead.
New accounts are now created through the following method:
Accounts.createUser(email,password,callback)
After logging out, users can log back in by completing a form with their email and password. However, I encountered an issue while trying to use the
Meteor.loginWithPassword(email,password,callback)
method; it continuously returns a 400 error code, specifically prompting "Match failed". Below is my current code snippet for handling user login after account creation:
Login Form:
<label class="item item-input">
<input ng-model="logger.existingEmail" on-return="logger.loginExistingUser()" type="text" placeholder="Enter your email">
</label>
<br>
<label class="item item-input">
<input ng-model="logger.existingPassword" on-return="logger.loginExistingUser()" type="text" placeholder="Enter your password">
</label>
JavaScript Function:
login() {
if (_.isEmpty(this.existingEmail) ||_.isEmpty(this.existingPassword)) return;
Meteor.loginWithPassword(this.existingEmail,this.existingPassword,function(err){
if(err){
console.log(err);
}
});
}
- I have tried various methods including:
- Logging in with email and password
- Logging in with user id and password (user id generated in MongoDB)
- Directly passing email and password to Meteor.loginWithPassword
- Passing user id directly to Meteor.loginWithPassword
The variables have been confirmed as valid right before executing the Meteor.loginWithPassword function.
Current Environment:
accounts-password 1.3.3
meteor 1.4.2.3
If you have any tips or suggestions, please feel free to share. Apologies for the rushed format of this post; I just wanted to get this question out there quickly. Thank you for your help!