Accounts.createUser fails


#1

Hi,

I recently upgraded to 1.2 (and just patched with 1.2.0.2) and I noticed that my user registration isn’t working correctly anymore. I’m currently getting the following error:

You've been logged out by the server. Please log in again.

More detailed:

error: 403
errorType: "Meteor.Error"
message: "You've been logged out by the server. Please log in again. [403]"
reason: "You've been logged out by the server. Please log in again."

My code is pretty simple and used to work just fine:

var accountDetails = {
   email: username,
   password: password,
   profile: {
     firstName: firstname,
     lastName: lastname
   }
};

Accounts.createUser( accountDetails, function( error ) {
  if( error ) {
    console.log("createUser");
    console.log(error);   // <-- The error triggered!
   }
  else {
    Meteor.loginWithPassword( accountDetails.email, accountDetails.password, function( error ) {
      if( error ) {
        console.log("loginWithPassword");
        console.log(error);
      }
      else {
         Router.go('home');
      }
    });
  }
});

Is anyone else experiencing issues with this? Any help/insights would be much appreciated.

Thanks,
Luke


#2

Shouldn’t this line

be

Meteor.loginWithPassword( {email: accountDetails.email, password: accountDetails.password}, function( error ) {

#3

Hi,

Not according to the documentation it is:

http://docs.meteor.com/#/full/meteor_loginwithpassword

We tracked down the issue since posting. It turned out that there was a problem with connecting to our email provider’s API to send a welcome aboard email. However, the error wasn’t properly handled and caught by the Accounts package whom in turn reported it as one of it’s own errors.

Exceptions in Javascript are a wonderful thing (not).

Thanks everyone.