Skip to content
This repository was archived by the owner on Mar 22, 2022. It is now read-only.

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

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

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

kulakowka opened this issue Feb 26, 2016 · 4 comments

Comments

@kulakowka
Copy link
Contributor

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
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
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
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
Copy link
Contributor Author

@ekryski it's cool! 🍺🍺

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants