Login with user created on server side


So I have a confusing issue:

I’m building a little platform that when started for the first time ever, creates a ‘root’ account on the server side that an Administrator would then use to login to the client side and do admin functions like change password, create new user, etc.

So on server, I have

Meteor.startup(() => {
  if (Meteor.users.find().count() == 0)
            email: 'root@root.com',
            username: 'root',
            password: 'root'
        console.log("First time starting server! Creating root account! Please login as root and change password!");

Issue is that after that happens, I try to login on the client side, and simply can’t login with that account, although I can lookup Meteor.users and see that the root account definitely is in the user store. What’s weirder is that if i create a second account through the console on the client side, it automatically logs in with that new account, and then i can logout and login with the ‘root’ account successfully!

Does anyone know why this happens? i feel like theres an extra function the client side account creation must fire to enable client side login that creating users on the server side simply doesnt fire. Or is there something else that I’m not aware of?


This does seem like a strange bug. I’m not sure of the solution, but the first thing I would try after everything you said you tried would be to include this code on the server:

  forbidClientAccountCreation: true


What error do you get if you login from console?


No errors show when I login from console. Also, I have a form that the root user should be able to create new users with, (ie. username, email, password), and although users get created successfully, still can’t login with them for the first time through a login form. Only after a client side console login ie. Meteor.loginWithPassword(‘username’, ‘password’, then they can start logging in ON THAT CLIENT only. I tried creating a new user, and logged in through console with their account on my PC, and I logged in fine. However when they tried to login, they got the same problem, and couldn’t login through the form unless they logged in through the console at least once.

So now I’m convinced that something’s wrong with my client side code, and somethings not firing there.



I had event.preventDefault commented out. It was refreshing the page before it could fire off the login command.

sigh LAME.

Thanks anyways friends!