eddyystop / feathers-reduxify-authentication

Wrap feathers-client.authentication so it works with Redux, as well as authentication, authorization packages for React-Router.
MIT License
22 stars 13 forks source link

User blank with feathers-authentication v1 #2

Open altwohill opened 7 years ago

altwohill commented 7 years ago

Using feathers-authentication v1, we're expected to fetch user details separately from authenticating. This means store.auth.user is currently empty after authenticating.

Would much need to change to put some user details in there? I guess at the least it should put the ID extracted from the JWT into it.

mihailp commented 7 years ago

Yes, when using feathers-authentication v1 user in redux is null. This is a showstopper!

marshallswain commented 7 years ago

The simplest way to solve this would be to add an after create hook to the authentication service on the server. Query the user from the /users service and add it to hook.result. We already created a full page in the Feathers documentation that explains how to make this happen. I really recommend reading the new documentation in full. We have put it within your grasp to unstop the show! :wink:

eddyystop commented 7 years ago

Plerase reopen the issue if you don't feel its resolved.

eddyystop commented 7 years ago

Reopening so others can see solution.

marshallswain commented 7 years ago

Here is the link to the docs page: https://docs.feathersjs.com/guides/auth/recipe.customize-response.html

altwohill commented 7 years ago

One note, in order to work with feathers-reduxify-authentication, the hook should send the user information as result.data

hook => {
          hook.result.data = hook.params.user;
          // Don't expose sensitive information.
          delete hook.result.data.password;
        }