ra-data-feathers icon indicating copy to clipboard operation
ra-data-feathers copied to clipboard

logged in save user data

Open lalote opened this issue 4 years ago • 3 comments

Hello, in feathersjs when you logged in, you get the accessToken and user data (at least default configuration) . The accessToken is saved at localStorage, so, there are any posibility of add a authClient.options for save the user data in localStorage too?

lalote avatar Apr 26 '20 00:04 lalote

Right now We are following the react-admin interface. At least we are putting on localstorage permissions and token.

But if you want to access to all other props in user you can always do a GET to that service.

josx avatar Apr 27 '20 15:04 josx

@lalote Can you explain why this functionality should be included in ra-data-feathers, and not implemented elsewhere (e.g. in your application)?

If you need the user data to be saved immediately on login without retrieving it separately as @josx has suggested, I think the correct approach would be to listen for the login or authenticated events from the feathers client directly:

feathersClient.on('login', user => handleUserData(user));

FeathersJS .on(eventname, listener) documentation for reference.

I just don't see that the requested functionality should be the responsibility of ra-data-feathers. This library is just a connector between feathersClient and React Admin.

If you can explain why I'm wrong here, I'd be happy to write a pull request for you (as long as @josx is happy with it). Otherwise I'd suggest this issue should be closed as out of scope.

nicholasnelson avatar Jun 04 '20 21:06 nicholasnelson

Lets see what @lalote has to say before closing it.

josx avatar Jun 05 '20 22:06 josx