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

Authentication not worked with hooks.remove('password') #82

Closed
kulakowka opened this Issue Feb 26, 2016 · 4 comments

Comments

Projects
None yet
2 participants
@kulakowka
Copy link
Contributor

kulakowka commented Feb 26, 2016

When I try to login POST http://localhost:3030/auth/local, I get an error:

{
  "name": "GeneralError",
  "message": "data and hash arguments required",
  "code": 500,
  "className": "general-error",
  "data": {},
  "errors": {}
}

In this situation, I have one hook for users service:

exports.after = {
  all: [],
  find: [
    hooks.remove('password')
  ],
  get: [],
  create: [],
  update: [],
  patch: [],
  remove: []
}

When i remove

hooks.remove('password')

from after find hook, authentication is worked!

This is because the auth service uses method .find() in users service.

@ekryski

This comment has been minimized.

Copy link
Member

ekryski commented Feb 26, 2016

@kulakowka yes it's because of this issue feathersjs-ecosystem/feathers-hooks#48

There's a PR open for it: feathersjs-ecosystem/feathers-hooks#51. Will be merge shortly 😄

@ekryski

This comment has been minimized.

Copy link
Member

ekryski commented Feb 26, 2016

feathers-hooks@1.2.0 now fixes this. As an example, say we want to only remove the password if it is an external call (ie. over sockets or http(s)):

exports.after = {
  all: [hooks.remove('password', hook => hook.params.provider)]
};
@ekryski

This comment has been minimized.

Copy link
Member

ekryski commented Feb 26, 2016

We're going to make one more change so that you don't even need to do that.

@kulakowka

This comment has been minimized.

Copy link
Contributor Author

kulakowka commented Feb 26, 2016

@ekryski it's cool! 🍺🍺

@kulakowka kulakowka closed this Feb 26, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.