maxmantz / redux-oidc-example

Small ReactJS application to demonstrate the usage of redux-oidc
MIT License
108 stars 68 forks source link

Initial call to loadUser() #15

Closed jonaskello closed 6 years ago

jonaskello commented 6 years ago

https://github.com/maxmantz/redux-oidc-example/blob/991104d9d6431d03725067062078c4e6f0bf378e/src/store.js#L30

Why is this initial call to loadUser() done? I removed it and it seems to work anyway :-).

maxmantz commented 6 years ago

This is needed to load an existing user into the redux store. The app will work without it, but the user manager keeps user data in session storage which gets picked up that way.

If you don't use it, when you reload the page, your user data is lost and you have to log in again. This is no only unnecessary but also potentially dangerous when you're creating new access tokens unnecessarily. Please keep using loadUser.