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

PUT /session to return 401 Invalid credentials, not 401 Invalid password #85

Closed
8 tasks done
gr2m opened this issue Feb 21, 2016 · 14 comments
Closed
8 tasks done

Comments

@gr2m
Copy link
Member

gr2m commented Feb 21, 2016

part of #83

:octocat: First Timers only

We would like to take the opportunity to invite someone who did not yet contribute to Hoodie to work on this issue. Follow @YourFirstPR on Twitter for more of these issues across many open source projects :)


🐛 The Bug

Our implementation diverges from our JSON API specification. When trying to sign in with a valid username, but invalid password, the server will respond with the message ”Invalid password”, while the specification says ”Invalid credentials”

📋 Steps to fix

  • claim this issue (@breun)
  • Setup repository locally and make sure that all tests pass
  • Adjust the test in tests/integration/routes/session-test.js to assert that the server will respond with ”Invalid credentials”.
  • Make sure tests fail when you run npm test. Commit with test: 401 Invalid password -> 401 Invalid credentials
  • Start a Pull Request.
    (If this is your first, welcome 🎉 😄 Here is a great tutorial on how to send a pull request)
  • Implement the change :)
  • Make sure tests pass. Commit with fix: 401 Invalid password -> 401 Invalid credentials
  • You are done 👏 comment below that your pull request is ready for review

Ping us in the Hoodie Chat or on Twitter if you have any questions :)

@breun
Copy link
Contributor

breun commented Feb 21, 2016

I'm giving this a go!

@breun
Copy link
Contributor

breun commented Feb 21, 2016

I forked the repository to my GitHub account, cloned it to my computer and ran npm install. Sadly that throws all kinds of connection errors:

~/Projects/hoodie-server-account $ npm install
npm WARN deprecated npmconf@2.1.2: this package has been reintegrated into npm and is now out of date with respect to npm
npm WARN deprecated lodash@1.0.2: lodash@<3.0.0 is no longer maintained. Upgrade to lodash@^4.0.0.
npm WARN deprecated graceful-fs@1.2.3: graceful-fs version 3 and before will fail on newer node releases. Please update to graceful-fs@^4.0.0 as soon as possible.
npm ERR! Darwin 15.3.0
npm ERR! argv "/opt/local/bin/node" "/opt/local/bin/npm" "install"
npm ERR! node v4.3.1
npm ERR! npm  v2.14.18
npm ERR! code ECONNRESET
npm ERR! errno ECONNRESET
npm ERR! syscall read

npm ERR! network read ECONNRESET
npm ERR! network This is most likely not a problem with npm itself
npm ERR! network and is related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network 
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly.  See: 'npm help config'
npm ERR! Darwin 15.3.0
npm ERR! argv "/opt/local/bin/node" "/opt/local/bin/npm" "install"
npm ERR! node v4.3.1
npm ERR! npm  v2.14.18
npm ERR! code ECONNRESET
npm ERR! errno ECONNRESET
npm ERR! syscall read

npm ERR! network read ECONNRESET
npm ERR! network This is most likely not a problem with npm itself
npm ERR! network and is related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network 
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly.  See: 'npm help config'
npm ERR! Darwin 15.3.0
npm ERR! argv "/opt/local/bin/node" "/opt/local/bin/npm" "install"
npm ERR! node v4.3.1
npm ERR! npm  v2.14.18
npm ERR! code ECONNRESET
npm ERR! errno ECONNRESET
npm ERR! syscall read

npm ERR! network read ECONNRESET
npm ERR! network This is most likely not a problem with npm itself
npm ERR! network and is related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network 
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly.  See: 'npm help config'
npm ERR! Darwin 15.3.0
npm ERR! argv "/opt/local/bin/node" "/opt/local/bin/npm" "install"
npm ERR! node v4.3.1
npm ERR! npm  v2.14.18
npm ERR! code ECONNRESET
npm ERR! errno ECONNRESET
npm ERR! syscall read

npm ERR! network read ECONNRESET
npm ERR! network This is most likely not a problem with npm itself
npm ERR! network and is related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network 
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly.  See: 'npm help config'
npm ERR! Darwin 15.3.0
npm ERR! argv "/opt/local/bin/node" "/opt/local/bin/npm" "install"
npm ERR! node v4.3.1
npm ERR! npm  v2.14.18
npm ERR! code ECONNRESET
npm ERR! errno ECONNRESET
npm ERR! syscall read

npm ERR! network read ECONNRESET
npm ERR! network This is most likely not a problem with npm itself
npm ERR! network and is related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network 
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly.  See: 'npm help config'
npm ERR! Darwin 15.3.0
npm ERR! argv "/opt/local/bin/node" "/opt/local/bin/npm" "install"
npm ERR! node v4.3.1
npm ERR! npm  v2.14.18
npm ERR! code ECONNRESET
npm ERR! errno ECONNRESET
npm ERR! syscall read

npm ERR! network read ECONNRESET
npm ERR! network This is most likely not a problem with npm itself
npm ERR! network and is related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network 
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly.  See: 'npm help config'

The whole things seems to hang now. I'm not behind a proxy AFAIK.

@gr2m
Copy link
Member Author

gr2m commented Feb 21, 2016

Weclome @breun, issue is all yours :)

I’m looking into the problem now.

@gr2m
Copy link
Member Author

gr2m commented Feb 21, 2016

@breun I had no luck, I’m afraid. It might have been a temporary hiccup. Can you try this please:

$ rm -rf node_modules && npm_config_loglevel=silly npm install

And post the logs somewhere? It might be quite a lot, so maybe put it in a gist and link it here if possible.
If it fails again, can you try to install something else? like npm install --global npm@2 to update your npm to the latest 2.x.x version?

@gr2m gr2m added in progress and removed ready labels Feb 21, 2016
@breun
Copy link
Contributor

breun commented Feb 21, 2016

I updated to npm 2.14.19 and tried again. It doesn't seem to be a temporary hiccup, I already retried twice before and npm install fails (and hangs) again: https://gist.github.com/breun/73e51484366450904947

@gr2m
Copy link
Member Author

gr2m commented Feb 21, 2016

What was before npm sill install resolved []?

@gr2m
Copy link
Member Author

gr2m commented Feb 21, 2016

I’m running a bit out of ideas :/ Did you ever install something with sudo npm install?

Can you try npm config set registry http://registry.npmjs.org/. If it doesn't help, reset it with npm config set registry https://registry.npmjs.org/. (it’s http:// vs https://)

@breun
Copy link
Contributor

breun commented Feb 21, 2016

After running npm config set registry http://registry.npmjs.org/ the npm install command finished successfully. I'm not a big fan of disabling HTTPS though.

I recently also had an issue with git clones done by MacPorts failing because of a certificate issue: https://trac.macports.org/ticket/50469

These issues might have the same root cause (my npm is also installed via MacPorts), but in both cases I just don't get enough information from the logging to find out what's really wrong. :(

@gr2m
Copy link
Member Author

gr2m commented Feb 21, 2016

try to uninstall your node & npm entirely, and install it as advised on https://nodejs.org/en/

@breun
Copy link
Contributor

breun commented Feb 21, 2016

Yeah sorry, no, not gonna do that. I prefer finding and fixing the cause of this issue to starting over with an npm install not managed by a package manager.

I have a fix ready though.

@gr2m
Copy link
Member Author

gr2m commented Feb 21, 2016

fixed via #86. Thanks a ton @breun 👍
Your fix was released in https://github.com/hoodiehq/hoodie-server-account/releases/tag/v2.6.3

We have more starter issues if you’d like to give it another spin: http://go.hood.ie/hoodie-starter-issues
I’ve also invited you to the https://github.com/hoodiehq/ contributors team, welcome :)

@breun
Copy link
Contributor

breun commented Feb 21, 2016

I'm actually not doing much JavaScript normally, but I enjoy seeing how this project deals with issues, tests, getting people involved, etc., so I might just fix a few more issues if I can find the time. Thanks for the invite.

@gr2m
Copy link
Member Author

gr2m commented Feb 21, 2016

Glad to hear that, thanks for the feedback :)

@nolanlawson
Copy link
Member

rm -fr node_modules && npm cache clear && npm install is often a good choice for stuff like this. I agree node/npm can be a pain when it gets into a weird state, though, and a full reinstall is sometimes necessary (especially if sudo was ever, ever involved...).

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

No branches or pull requests

3 participants