Meteor.loginWithPassword method doesn't response on success

ı have an issue with Meteor.loginWithPassword method when creating my login page…
I implemented all the directions which are in the meteor docs but I was’t able to get result successfully…

my handleSubmit function for login form like that;

const handleLoginSubmit = (e) => {
  Meteor.loginWithPassword( {email}, password, (error) => {
        } else {
          console.log("You logged in successfully")

when I insert incorrect email or password i am getting errors (“user not found”, “incorrect password”) but when i insert correct email and password it gives nothing…
the email and password belong the user which i created with Accounts.createUser() …The user can be seen in my mongoDB users collection.
Also when i insert correct values for email and password, loginTokens has been creating in services.resume in my user document mongoDB…

const user = meteor.user()

returning “null”

what am i doing wrong ?


I’ve the same issue. I haven’t been able to fix this issue for 3 days.

1 Like

I think this problem is cronic for new meteor versions because i have the same problem and haven’t solved yet…
Unfortunately, the sources about this issue are insufficent on developer forums :frowning:

1 Like

I can confirm with

Meteor 2.11.0

everything works as aspected.

This is my function:

const signIn = (email, password, route, history) => {
  return dispatch => {
    Meteor.loginWithPassword(email, password, err => {
      if (err) {
        if (err.reason === 'User not found') {
          err.reason = 'An account with this sign-in details does not exist. Try again or create a new account.'
        dispatch({ // this is a Redux dispatch - just a function.
          type: SIGN_IN,
          payload: `Error logging email: ${err}`
      } else {
          type: SIGN_IN,
          payload: email

1 Like

thanks Paul for your response…

now i am changing my versions and then try again…i will share the result

Meteor 2.11.0

i have upgraded my versions and tried again but nothing has changed :frowning:

You can get a local copy of accounts-password have it hooked to your project and add some console logs inside internalLoginWithPassword that you can find in password_client.js

I tried internalLoginWithPassword but noth,ng has changed…I couldn’t get any response on success

I am not sure you can use internalLoginWithPassword in your client. My point was to log some outputs from the internal mechanism of the package and see where a return is being blocked for you.

Could u give me some more details because i can’t find password_client.js

What I do: download this package as a zip: meteor/packages/accounts-password at devel · meteor/meteor · GitHub
Alternatively you can get the whole repo as a zip and only pull out this package from the zip.
In your main project folder (where you have package.json) create a folder named packages. Put accounts-password in the folder, go to its package.js and increase the version number.
meteor remove accounts-password followed by meteor add accounts-password.
Now you should be running with your local version. This is the procedure to run any Meteor local package.
Now in the file I mentioned you can find the login function. Every update of a local package should trigger a restart of the dev server. If this doesn’t happen, make sure you restart the server to make sure you are running with the updated version of the local package.

I think I did what you said…I can get error result when an err occured, but on success there is no result…It seems missing in userCallback function “else” part.

output of incorrect password ;

output of correct password;

***the output of “package used…” is getting from loginWithPassword funtion in password_client.js

Also updates in password_client.js don’t trigger a restart of the dev server but client refresh…
I m using updated packages

Meteor 2.11.0

Versions are same in both meteor folder and local packages folder

Is there anyone who has an idea about the source of the problem ?

Check this guy: Meteor, Accounts.callLoginMethod() doesn't call custom login handler on mobile device - Stack Overflow
Sometimes it just happens and there is no way to tell why it happens that way.

Look, on OSX, all Meteor packages are under username/.meteor/packages/package_name/versions…
All previous versions are stored there. It happened to me in the past to have problems with some core packages after Meteor release updates. A new release would still use an old package in dev although the latest package was showing in the packages file.

I suggest you do a meteor remove for all accounts related packages and delete all related folders under meteor packages and then re-add the packages. Alternatively you can delete all packages and let Meteor reinstall all of them.

I think problem is related with the mongoDB version because i created a new meteor project with the latest mongo version and used same login component and then it works :slight_smile:
I will try upgrade my main mongo version