scottbrady91 / Angular4-OidcClientJs-Example

Code from scottbrady91.com/Angular
https://www.scottbrady91.com/Angular/SPA-Authentiction-using-OpenID-Connect-Angular-CLI-and-oidc-client
71 stars 60 forks source link

please change the following code #2

Closed chriseugenerodriguez closed 6 years ago

chriseugenerodriguez commented 7 years ago

Hi,

I found a problem with your code that fixed issue with my on refreshing the browser and losing the data which I struggled for weeks.

change this: private user: User = null;

this this: private user: User;

What I found is that this fire on initialization and when you refresh browser and it is injected as a provider it will reset the value. Ultimately thinking your are logged in on the back end, but not actually loggedin on the front end because you can't retrieve any user data.