Meteor Accounts.loginWithPassword “400 Match Failed” Error

岁酱吖の 提交于 2019-12-25 08:09:43

问题


I'm playing around with the Angular Meteor tutorial that uses Ionic to create a WhatsApp Clone. I changed the phone verification to a normal user setup using username/password.

Accounts are created using

    Accounts.createUser(email,password,callback)

When they logout and attempt to log back in, I have a form that an existing user can use to fill in their email and password. I cannot get the

    Meteor.loginWithPassword(email,password,callback)

method to work for this scenario; it keeps saying that I have a 400 error, which is "Match failed". Below is my code for logging in to a user once the account has already been created:

Form:

    <label class="item item-input">
        <input ng-model="logger.existingEmail" on-return="logger.loginExistingUser()" type="text" placeholder="Your existing email">
    </label>
    <br>
    <label class="item item-input">
        <input ng-model="logger.existingPassword" on-return="logger.loginExistingUser()" type="text" placeholder="Your existing password">
    </label>

JS:

    login() {
      if (_.isEmpty(this.existingEmail) ||_.isEmpty(this.existingPassword)) return;
      Meteor.loginWithPassword(this.existingEmail,this.existingPassword,function(err){
        if(err){
          console.log(err);
        }
      });
    }
  • I have created multiple accounts and tried the following:
    • logging in with email and password
    • logging in with user id and password (user id generated in mongodb)
    • passing in email and password directly to Meteor.loginWithPassword
    • passing in user id and directly to Meteor.loginWithPassword

The variables are valid just before the Meteor.loginWithPassword call.

I'm using:

    accounts-password 1.3.3
    meteor 1.4.2.3

Any tips? Sorry about the poor format of the post, I'm in a hurry and just wanted to get this question up. Thank you in advance!


回答1:


Resolved. The package

    mys:accounts-phone

was causing the error. Removed this package and login works as normal.



来源:https://stackoverflow.com/questions/41600480/meteor-accounts-loginwithpassword-400-match-failed-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!