Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Does not populate user for other services #150
I'm trying to get the user within a service find call where the user has been authenticated and there is JWT
// Register a before hook to get user for use in profile service
I am using feathers authentication version 0.7.0
In the hooks params object I have the following, no matter what I do no idField gets populated and the user does not get populated.
What am I missing, why is the user not getting populated for use in my service?
Here's the gist.
http.js runs on the server side, and socketConnection.js is the client side code talking to it
ok, I've got to the root of it.
I added some diagnostics into the Feathers Authentication plugin.
There were two things going on. My id field was email. As soon as I added that in config
This led to getting a not authenticated message but it was leaking the user object to the client including the hashed password. This is because it was returning the error object, because my user service had a find and create method but not a get method that feathers-authentication tried to call. Because I'd just done a local auth with email and password the user object was in the response.
So I've added a get method to my user service and now it authenticates and returns the user object in the authenticated response. I can also see it's available to my service on the server so far so good.
However the password is being returned to the client in the authenticated response and I thought feathers-authentication stripped out the password from the user object?
@PhilWhitehurst the default
The password does get stripped by auth but if you are monkeying with the user service and overriding methods then I can't guarantee that it will work as expected. You also would need to make sure you are on auth v0.7.0+.
In all honesty I'd have to see a link to code. The gist above doesn't show your user service.