Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resumed login failure #16

Closed
damienrobson opened this issue Dec 3, 2018 · 6 comments
Closed

Resumed login failure #16

damienrobson opened this issue Dec 3, 2018 · 6 comments

Comments

@damienrobson
Copy link

I get the following when I try to resume a session (i.e. when returning to the site after passing true to loginWithPassword). Initial login is fine and behaves as normal, but on returning to the site, I need to log in again. Any ideas?

Exception while invoking method 'login' Error: shouldn't happen (validation missed something)
     at AccountsServer.Accounts._findUserByQuery (packages/accounts-password/password_server.js:135:13)
     at AccountsServer.Accounts.findUserByUsername (packages/accounts-password/password_server.js:165:19)
     at Module.findUserByUsername (packages/tprzytula:remember-me/server/integration/accounts.js:22:56)
     at ShouldResumeBeAccepted._getUsersLoginTokens (packages/tprzytula:remember-me/server/loginAttemptValidator/validators/shouldResumeBeAccepted.js:80:42)
     at ShouldResumeBeAccepted._getResume (packages/tprzytula:remember-me/server/loginAttemptValidator/validators/shouldResumeBeAccepted.js:57:34)
     at ShouldResumeBeAccepted.validate (packages/tprzytula:remember-me/server/loginAttemptValidator/validators/shouldResumeBeAccepted.js:35:33)
     at failedValidator._validators.find.validator (packages/tprzytula:remember-me/server/loginAttemptValidator/index.js:32:79)
     at Array.find (native)
     at LoginAttemptValidator.validate (packages/tprzytula:remember-me/server/loginAttemptValidator/index.js:32:50)
     at RememberMe._validateAttempt (packages/tprzytula:remember-me/server/index.js:62:64)
     at packages/callback-hook/hook.js:130:22
     at _validateLoginHook.each.callback (packages/accounts-base/accounts_server.js:154:15)
     at Hook.each (packages/callback-hook/hook.js:108:15)
     at AccountsServer._validateLogin (packages/accounts-base/accounts_server.js:151:29)
     at AccountsServer._attemptLogin (packages/accounts-base/accounts_server.js:338:10)
     at MethodInvocation.methods.login (packages/accounts-base/accounts_server.js:520:23)
     at maybeAuditArgumentChecks (packages/ddp-server/livedata_server.js:1767:12)
     at DDP._CurrentMethodInvocation.withValue (packages/ddp-server/livedata_server.js:719:19)
     at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1304:12)
     at DDPServer._CurrentWriteFence.withValue (packages/ddp-server/livedata_server.js:717:46)
     at Meteor.EnvironmentVariable.EVp.withValue (packages/meteor.js:1304:12)
     at Promise (packages/ddp-server/livedata_server.js:715:46)
     at new Promise (<anonymous>)
     at Session.method (packages/ddp-server/livedata_server.js:689:23)
     at packages/ddp-server/livedata_server.js:559:43
@tprzytula
Copy link
Owner

tprzytula commented Dec 3, 2018

Thank you for raising the issue.
I didn't have time yet to try to reproduce it but I think I might find the problem.

Does the user have a username? Or do you identify them using only the mail instead?
At some point, I'm fetching the user record by using it's "username" but if your user doesn't have this field or it's empty then this error could occur.

I will make sure to work on a fix if my assumption is correct.

Sorry for the inconvenience!

@damienrobson
Copy link
Author

Hi @tprzytula - I've checked my user object and we definitely aren't using username. Our users login with email address only.

Thanks for your quick reply!

@tprzytula
Copy link
Owner

Hi @damienrobson - I've just published a version 1.0.1 that contains the fix. Let me know if you would encounter any problems! Thanks 👍

@damienrobson
Copy link
Author

damienrobson commented Dec 4, 2018

Thanks, but still no joy - I'm not sure I'm using this correctly. My code is as follows:

    const { email, password, rememberMe } = this.state;
    RememberMe.loginWithPassword(
      email,
      password,
      err => {
        // normal login stuff
      },
      rememberMe // whether checkbox is ticked or not
    );

Login works but if I close the tab and re-open it (having ticked remember me) I have to log in again and the error is still present in the server

@tprzytula tprzytula reopened this Dec 4, 2018
@tprzytula
Copy link
Owner

Hi @damienrobson, yes you are using it correctly.

I've tried to replicate the problem but didn't succeed.
I published my reproduction repo: https://github.com/tprzytula/RememberMe-Issue16

Could you ensure if:

  • the rememberMe value from your state is correct
  • you have version 1.0.1 on both client & server

Any ideas how can I reproduce it? Maybe it conflicts with some other dependency?

@damienrobson
Copy link
Author

Thanks for checking - I've found the issue. As you suggested, the version hadn't updated on the client, so it was stuck in the same loop. Thanks again, sorry to have wasted your time and resources 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants